From daf4cb1491e1c01d47db6a778470d60baa630aca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?=
 <stephane.adjemian@univ-lemans.fr>
Date: Fri, 27 Jun 2014 23:12:05 +0200
Subject: [PATCH] Added unitary tests.

---
 matlab/utilities/dseries/from.m | 56 +++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/matlab/utilities/dseries/from.m b/matlab/utilities/dseries/from.m
index 02be013679..81fd5bc162 100644
--- a/matlab/utilities/dseries/from.m
+++ b/matlab/utilities/dseries/from.m
@@ -436,3 +436,59 @@ function i = isassignedvariable(var,expr)
 %$
 %$ T = all(t);
 %@eof:1
+
+%@test:2
+%$ try
+%$     y = dseries(zeros(400,1),dates('1950Q1')) ;
+%$     v = dseries(randn(400,1),dates('1950Q1')) ;
+%$     u = dseries(randn(400,1),dates('1950Q1')) ;
+%$     from 1950Q2 to 2049Q3 do y(t) = (1+.01*u(t))*y(t+1) + v(t)
+%$     t(1) = 0;
+%$ catch
+%$     t(1) = 1;
+%$ end
+%$
+%$ T = all(t);
+%@eof:2
+
+%@test:3
+%$ try
+%$     y = dseries(zeros(400,1),dates('1950Q1')) ;
+%$     v = dseries(randn(400,1),dates('1950Q1')) ;
+%$     u = dseries(randn(400,1),dates('1950Q1')) ;
+%$     from 1950Q2 to 2049Q4 do y(t) = v(t) -.5*v(t-1);
+%$     t(1) = 1;
+%$ catch
+%$     t(1) = 0;
+%$ end
+%$
+%$ T = all(t);
+%@eof:3
+
+%@test:4
+%$ try
+%$     y = dseries(zeros(400,1),dates('1950Q1')) ;
+%$     v = dseries(randn(400,1),dates('1950Q1')) ;
+%$     u = dseries(randn(400,1),dates('1950Q1')) ;
+%$     from 1950Q2 to 2049Q4 do y(t) = 2*((v(t) -.5*v(t-1))>0)-1;
+%$     t(1) = 1;
+%$ catch
+%$     t(1) = 0;
+%$ end
+%$
+%$ T = all(t);
+%@eof:4
+
+%@test:5
+%$ try
+%$     y = dseries(zeros(4000,1),dates('1950Q1')) ;
+%$     v = dseries(randn(4000,1),dates('1950Q1')) ;
+%$     u = dseries(randn(4000,1),dates('1950Q1')) ;
+%$     from 1950Q2 to 2949Q4 do y(t) = y(t-1)*(2*((v(t) -.5*v(t-1))>u(t))-1)+u(t); %plot(y)
+%$     t(1) = 1;
+%$ catch
+%$     t(1) = 0;
+%$ end
+%$
+%$ T = all(t);
+%@eof:5
-- 
GitLab