Added tests for `not` subroutine in stdlib.
authorAaron Taylor <ataylor@subgeniuskitty.com>
Wed, 31 Jul 2019 22:05:12 +0000 (15:05 -0700)
committerAaron Taylor <ataylor@subgeniuskitty.com>
Wed, 31 Jul 2019 22:05:12 +0000 (15:05 -0700)
stdlib_tests/3001_not.pvvs [new file with mode: 0644]
stdlib_tests/vv_test.py

diff --git a/stdlib_tests/3001_not.pvvs b/stdlib_tests/3001_not.pvvs
new file mode 100644 (file)
index 0000000..8af83b3
--- /dev/null
@@ -0,0 +1,28 @@
+@ All zeros to all ones
+SSSSN           | PUSH 0
+NSTTSTSSSN      | JSR > 101000 (not)
+NSTTSSTN        | JSR > 1001 (print number from stack)
+
+@ All ones to all zeros
+SSTTN           | PUSH -1
+NSTTSTSSSN      | JSR > 101000 (not)
+NSTTSSTN        | JSR > 1001 (print number from stack)
+
+@ Test alternating bits, leading zero.
+@ Note that 6148914691236517205 = 0101...0101
+SSSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTN  | PUSH +6148914691236517205
+NSTTSTSSSN      | JSR > 101000 (not)
+NSTTSSTN        | JSR > 1001 (print number from stack)
+
+@ Test alternating bits, leading one.
+@ Note that -6148914691236517206 = 1010...1010 in twos-complement but we 
+@ enter it in sign magnitude format so the bit pattern appears different.
+SSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTSTTSN | PUSH -6148914691236517206
+NSTTSTSSSN      | JSR > 101000 (not)
+NSTTSSTN        | JSR > 1001 (print number from stack)
+
+@ All done.
+NNN             | DIE
+
+#include <logic.pvvs>
+#include <stdio.pvvs>
index 381a732..bc8d27c 100755 (executable)
@@ -30,6 +30,7 @@ tests = [
         ['2005_memcmp', '', '+1'],
         ['2006_memsrch', '', '+32'],
         ['2007_memrand', '', ''],
         ['2005_memcmp', '', '+1'],
         ['2006_memsrch', '', '+32'],
         ['2007_memrand', '', ''],
+        ['3001_not', '', '-1+0-6148914691236517206+6148914691236517205'],
         ] 
 
 for test in tests:
         ] 
 
 for test in tests: