* Bug #9005 fixed - The bitset function did not have any tests. 65/9865/2
Sylvestre Ledru [Thu, 29 Nov 2012 13:12:04 +0000 (14:12 +0100)]
Change-Id: Ifaa173d79915bcad42b4af2a6de0b63a20253800

scilab/CHANGES_5.4.X
scilab/modules/elementary_functions/tests/unit_tests/bitset.dia.ref [new file with mode: 0644]
scilab/modules/elementary_functions/tests/unit_tests/bitset.tst [new file with mode: 0644]

index 9248c40..6859ddb 100644 (file)
@@ -102,6 +102,8 @@ Bug fixes
 * Bug #8883 fixed - In some cases, Scilab build from sources was looking for
                    libraries at the wrong place.
 
+* Bug #9005 fixed - The bitset function did not have any tests.
+
 * Bug #10661 fixed - xmltopdf & xmltopdf were failing in the binary version.
 
 * Bug #11474 fixed - save_format help page was still refering to the old save
diff --git a/scilab/modules/elementary_functions/tests/unit_tests/bitset.dia.ref b/scilab/modules/elementary_functions/tests/unit_tests/bitset.dia.ref
new file mode 100644 (file)
index 0000000..16a3169
--- /dev/null
@@ -0,0 +1,13 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+assert_checkequal(bitset(uint8(9), 5), uint8(25));
+assert_checkequal(bitset(uint8(25), 5, 0), uint8(9));
+assert_checkequal(bitset(25, 5, 0), 9);
+assert_checkerror("bitset(2)",[],10000);
+assert_checkerror("bitset(""aze"")",[],10000);
+assert_checkerror("bitset(-25, 5)",[],10000);
+a=[170,82,24,89,92,59,220,141];
+assert_checkequal(bitset(a,1), [171,83,25,89,93,59,221,141]);
diff --git a/scilab/modules/elementary_functions/tests/unit_tests/bitset.tst b/scilab/modules/elementary_functions/tests/unit_tests/bitset.tst
new file mode 100644 (file)
index 0000000..5383c7b
--- /dev/null
@@ -0,0 +1,17 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+
+assert_checkequal(bitset(uint8(9), 5), uint8(25));
+assert_checkequal(bitset(uint8(25), 5, 0), uint8(9));
+assert_checkequal(bitset(25, 5, 0), 9);
+
+assert_checkerror("bitset(2)",[],10000);
+assert_checkerror("bitset(""aze"")",[],10000);
+
+assert_checkerror("bitset(-25, 5)",[],10000);
+a=[170,82,24,89,92,59,220,141];
+assert_checkequal(bitset(a,1), [171,83,25,89,93,59,221,141]);