[gcalctool] Test for some more boolean logic



commit b42b8e63a79a365b93582449e167cee9b0ec718d
Author: Robert Ancell <robert ancell gmail com>
Date:   Mon Mar 29 13:52:59 2010 +1100

    Test for some more boolean logic

 src/gtk.c               |    8 ++++----
 src/mp-equation-lexer.l |    2 +-
 src/unittest.c          |   14 +++++++++++++-
 3 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/src/gtk.c b/src/gtk.c
index 2cbfed4..efdf6e8 100644
--- a/src/gtk.c
+++ b/src/gtk.c
@@ -73,10 +73,10 @@ static ButtonData button_data[] = {
     {"hyperbolic_cosine",  "cosh"},
     {"hyperbolic_tangent", "tanh"},
     {"inverse",            "�¹"},
-    {"and",                " AND "},
-    {"or",                 " OR "},
-    {"xor",                " XOR "},
-    {"not",                " NOT "},
+    {"and",                "â?§"},
+    {"or",                 "â?¨"},
+    {"xor",                "â?»"},
+    {"not",                "¬"},
     {"integer_portion",    "int"},
     {"fractional_portion", "frac"},
     {"ones_complement",    "ones"},
diff --git a/src/mp-equation-lexer.l b/src/mp-equation-lexer.l
index 1172aa0..a3fd1ab 100644
--- a/src/mp-equation-lexer.l
+++ b/src/mp-equation-lexer.l
@@ -69,7 +69,7 @@ VARIABLE {WORD}|{WORD}{SUB_NUM}|{WORD}"�¹"|{GREEKS}
 MOD  [mM][oO][dD]
 AND  "â?§"|[aA][nN][dD]
 OR   "â?¨"|[oO][rR]
-XOR  "â??"|[xX][oO][rR]
+XOR  "â?»"|"â??"|[xX][oO][rR]
 NOT  "¬"|"~"|[nN][oO][tT]
 IN   [iI][nN]
 
diff --git a/src/unittest.c b/src/unittest.c
index 147480e..9a310e1 100644
--- a/src/unittest.c
+++ b/src/unittest.c
@@ -477,7 +477,7 @@ test_equations()
 
     options.angle_units = MP_GRADIANS;
     test("sin 100", "1", 0);
-
+  
     test("0 and 0", "0", 0);
     test("1 and 0", "0", 0);
     test("0 and 1", "0", 0);
@@ -502,6 +502,18 @@ test_equations()
     test("twos 1", "FFFFFFFFâ??â??", 0);
     test("twos 7FFFFFFFâ??â??", "80000001â??â??", 0);
     test("~7Aâ??â??", "FFFFFF85â??â??", 0);
+
+/*    base = 2;
+    options.wordlen = 4;
+    test("1100â??â?§1010â??", "1000â??", 0);
+    test("1100â??â?¨1010â??", "1110â??", 0);
+    test("1100â??â?»1010â??", "110â??", 0);
+    test("1100â??â??1010â??", "110â??", 0);
+    test("1100â??â?¼1010â??", "0111â??", 0);
+    test("1100â??â?½1010â??", "0001â??", 0);
+    options.wordlen = 2;
+    test("¬10â??", "1â??", 0);
+    test("¬¬10â??", "10â??", 0);*/
 }
 
 



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