[gcalctool/vala] Test not



commit 1575baca11d3ae5ca58865ccaa959176ab1c02ef
Author: Robert Ancell <robert ancell canonical com>
Date:   Sat Oct 13 09:52:45 2012 +1300

    Test not

 src/test-number.vala |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/src/test-number.vala b/src/test-number.vala
index e09ffcf..01e4ab9 100644
--- a/src/test-number.vala
+++ b/src/test-number.vala
@@ -979,6 +979,22 @@ private void test_xor ()
     pass ();
 }
 
+private void test_not ()
+{
+    for (var a = 0; a < 10; a++)
+    {
+        var z = (new Number.integer (a)).not (8);
+        var expected = ~a & 0xFF;
+        if (z.to_integer () != expected)
+        {
+            fail ("(%d).not () -> %lli, expected %d".printf (a, z.to_integer (), expected));
+            return;
+        }
+    }
+
+    pass ();
+}
+
 private void test_shift ()
 {
     for (var a = 0; a < 10; a++)
@@ -1067,7 +1083,7 @@ static int main (string[] args)
     test_and ();
     test_or ();
     test_xor ();
-    //test_not ();
+    test_not ();
     //test_mask ();
     test_shift ();
     //test_ones_complement ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]