Xcos tests: add a CUMSUM block test 89/10489/3
Clément DAVID [Fri, 15 Feb 2013 08:50:54 +0000 (09:50 +0100)]
Change-Id: I3f4d89963204f298a0b29a09fa719d4747177fe3

scilab/modules/xcos/tests/unit_tests/cumsum.dia.ref [new file with mode: 0644]
scilab/modules/xcos/tests/unit_tests/cumsum.tst [new file with mode: 0644]
scilab/modules/xcos/tests/unit_tests/cumsum.xcos [new file with mode: 0644]

diff --git a/scilab/modules/xcos/tests/unit_tests/cumsum.dia.ref b/scilab/modules/xcos/tests/unit_tests/cumsum.dia.ref
new file mode 100644 (file)
index 0000000..5837370
--- /dev/null
@@ -0,0 +1,27 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- XCOS TEST -->
+// CUMSUM block test
+loadXcosLibs();
+assert_checktrue(importXcosDiagram(SCI + "/modules/xcos/tests/unit_tests/cumsum.xcos"));
+scicos_simulate(scs_m, list());
+in = ones(4,2);
+v = cumsum_m.values(:,:,1);
+assert_checkequal(v, cumsum(in, "*"));
+v = cumsum_r.values(:,:,1);
+assert_checkequal(v, cumsum(in, "r"));
+v = cumsum_c.values(:,:,1);
+assert_checkequal(v, cumsum(in, "c"));
+// FIXME: to workspace does not handle complex numbers
+//in = complex(ones(4,2), (1:4)' * (1:2));
+//v = cumsumz_m.values(:,:,1);
+//assert_checkequal(v, cumsum(in, "*"));
+//
+//v = cumsumz_r.values(:,:,1);
+//assert_checkequal(v, cumsum(in, "r"));
+//
+//v = cumsumz_c.values(:,:,1);
+//assert_checkequal(v, cumsum(in, "c"));
diff --git a/scilab/modules/xcos/tests/unit_tests/cumsum.tst b/scilab/modules/xcos/tests/unit_tests/cumsum.tst
new file mode 100644 (file)
index 0000000..68a9605
--- /dev/null
@@ -0,0 +1,38 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Clément DAVID
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- XCOS TEST -->
+
+// CUMSUM block test
+
+loadXcosLibs();
+
+assert_checktrue(importXcosDiagram(SCI + "/modules/xcos/tests/unit_tests/cumsum.xcos"));
+scicos_simulate(scs_m, list());
+
+in = ones(4,2);
+
+v = cumsum_m.values(:,:,1);
+assert_checkequal(v, cumsum(in, "*"));
+
+v = cumsum_r.values(:,:,1);
+assert_checkequal(v, cumsum(in, "r"));
+
+v = cumsum_c.values(:,:,1);
+assert_checkequal(v, cumsum(in, "c"));
+
+// FIXME: to workspace does not handle complex numbers
+//in = complex(ones(4,2), (1:4)' * (1:2));
+//v = cumsumz_m.values(:,:,1);
+//assert_checkequal(v, cumsum(in, "*"));
+//
+//v = cumsumz_r.values(:,:,1);
+//assert_checkequal(v, cumsum(in, "r"));
+//
+//v = cumsumz_c.values(:,:,1);
+//assert_checkequal(v, cumsum(in, "c"));
+
diff --git a/scilab/modules/xcos/tests/unit_tests/cumsum.xcos b/scilab/modules/xcos/tests/unit_tests/cumsum.xcos
new file mode 100644 (file)
index 0000000..b35ce8d
Binary files /dev/null and b/scilab/modules/xcos/tests/unit_tests/cumsum.xcos differ