[gnome-calculator/60-split-out-a-backend-library] gcalc: test parse doubles



commit 922b0c75be2d8e0ab107d7754d01275195a95e15
Author: Daniel Espinosa Ortiz <esodan gmail com>
Date:   Wed Jan 2 16:25:06 2019 -0600

    gcalc: test parse doubles

 tests/gcalc-main-interfaces.vala | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/tests/gcalc-main-interfaces.vala b/tests/gcalc-main-interfaces.vala
index 48f36de7..67dd1494 100644
--- a/tests/gcalc-main-interfaces.vala
+++ b/tests/gcalc-main-interfaces.vala
@@ -23,7 +23,7 @@ class Tests {
   {
     GLib.Intl.setlocale (GLib.LocaleCategory.ALL, "");
     Test.init (ref args);
-    Test.add_func ("/gcalc/parser/constant",
+    Test.add_func ("/gcalc/parser/constant/integer",
     ()=>{
       try {
         var parser = new Parser ();
@@ -42,6 +42,25 @@ class Tests {
         warning ("Error: %s", error.message);
       }
     });
+    Test.add_func ("/gcalc/parser/constant/double",
+    ()=>{
+      try {
+        var parser = new Parser ();
+        var eqman = new GMathEquationManager ();
+        parser.parse ("10.3", eqman);
+        assert (eqman.equations.get_n_items () == 1);
+        var eq = eqman.equations.get_item (0) as MathEquation;
+        assert (eq != null);
+        assert (eq.expressions.get_n_items () == 1);
+        var p = eq.expressions.get_item (0) as Polynomial;
+        assert (p != null);
+        assert (p.expressions.get_n_items () == 1);
+        var c = p.expressions.get_item (0) as Constant;
+        assert (c != null);
+      } catch (GLib.Error error) {
+        warning ("Error: %s", error.message);
+      }
+    });
     return Test.run ();
   }
 }


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