aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/expressionParser_test.ml10
-rwxr-xr-xtests/expression_test.ml18
-rwxr-xr-xtests/odf/odf_ExpressionParser_test.ml5
-rwxr-xr-xtests/sheet_test.ml3
4 files changed, 14 insertions, 22 deletions
diff --git a/tests/expressionParser_test.ml b/tests/expressionParser_test.ml
index 476e3aa..30bd665 100755
--- a/tests/expressionParser_test.ml
+++ b/tests/expressionParser_test.ml
@@ -19,11 +19,10 @@ let test_num ctx = begin
let expected = Expression.Formula (
Expression.Expression (
- ScTypes.Value (
- ScTypes.Num (
- ScTypes.Number,
+ ScTypes.Value (ScTypes.number (
DataType.Num.of_num (Num.num_of_int 1)
- )))) in
+ )
+ ))) in
let result = load_expr "=1" in
assert_equal
@@ -54,8 +53,7 @@ let test_call2 ctx = begin
let expected = Expression.Formula (
Expression.Expression (
ScTypes.Call (
- u"foo2", [ScTypes.Value (ScTypes.Num (
- ScTypes.Number,
+ u"foo2", [ScTypes.Value (ScTypes.number (
DataType.Num.of_num (Num.num_of_int 4)
))]))) in
let result = load_expr "=foo2(4)" in
diff --git a/tests/expression_test.ml b/tests/expression_test.ml
index 0950383..2fa4d9b 100755
--- a/tests/expression_test.ml
+++ b/tests/expression_test.ml
@@ -28,7 +28,7 @@ let assert_equal expected result =
let test_str ctx = begin
let result = Expression.load @@ u"cafe" in
let expected = Expression.load_expr @@ Expression.Basic (
- ScTypes.Str (u"cafe")) in
+ ScTypes.string (u"cafe")) in
assert_equal expected result
end
@@ -36,7 +36,7 @@ end
let test_str_space ctx = begin
let result = Expression.load @@ u" =cafe" in
let expected = Expression.load_expr @@ Expression.Basic (
- ScTypes.Str (u" =cafe")) in
+ ScTypes.string (u" =cafe")) in
assert_equal expected result
end
@@ -45,15 +45,14 @@ let test_formula_str ctx = begin
let expected = Expression.load_expr @@ Expression.Formula (
Expression.Expression (
ScTypes.Value (
- ScTypes.Str (u"cafe")))) in
+ ScTypes.string (u"cafe")))) in
assert_equal expected result
end
let test_num ctx = begin
let result = Expression.load @@ u"123" in
let expected = Expression.load_expr @@ Expression.Basic (
- ScTypes.Num (
- ScTypes.Number,
+ ScTypes.number (
DataType.Num.of_num @@ Num.num_of_int 123
)) in
assert_equal expected result
@@ -62,8 +61,7 @@ end
let test_float ctx = begin
let result = Expression.load @@ u"12.45" in
let expected = Expression.load_expr @@ Expression.Basic (
- ScTypes.Num (
- ScTypes.Number,
+ ScTypes.number (
DataType.Num.of_num @@ T.Num.of_float_string "12.45"
)) in
assert_equal expected result
@@ -72,8 +70,7 @@ end
let test_relative ctx = begin
let result = Expression.load @@ u"-123" in
let expected = Expression.load_expr @@ Expression.Basic (
- ScTypes.Num (
- ScTypes.Number,
+ ScTypes.number (
DataType.Num.of_num @@ Num.num_of_int (-123)
)) in
assert_equal expected result
@@ -82,8 +79,7 @@ end
let test_date ctx = begin
let result = Expression.load @@ u"1900/01/01"
and expected = Expression.load_expr @@ Expression.Basic (
- ScTypes.Num (
- ScTypes.Date,
+ ScTypes.date (
DataType.Num.of_num @@ Date.get_julian_day 1900 01 01
)) in
assert_equal expected result
diff --git a/tests/odf/odf_ExpressionParser_test.ml b/tests/odf/odf_ExpressionParser_test.ml
index becf9ab..8b4e4ff 100755
--- a/tests/odf/odf_ExpressionParser_test.ml
+++ b/tests/odf/odf_ExpressionParser_test.ml
@@ -14,8 +14,7 @@ let _msg ~(expected:ScTypes.expression) ~(result:ScTypes.expression) =
-let build_num value = ScTypes.Num (
- ScTypes.Number,
+let build_num value = ScTypes.number (
DataType.Num.of_num @@ Num.num_of_int value
)
@@ -32,7 +31,7 @@ let test_formula ctx = begin
Call(u"CONCATENATE", [
Call (u"SUM", [
Ref (Range (((6, 16), (false, false)), (((36, 16), (false, false)))))]);
- Value (Str (u"/"));
+ Value (string (u"/"));
Call(u"*", [
Value (build_num 8);
Call(u"NETWORKDAYS", [
diff --git a/tests/sheet_test.ml b/tests/sheet_test.ml
index 084118f..7353dc6 100755
--- a/tests/sheet_test.ml
+++ b/tests/sheet_test.ml
@@ -16,8 +16,7 @@ let _msg ~expected ~result = begin
(get_string result)
end
-let build_num value = ScTypes.Num (
- ScTypes.Number,
+let build_num value = ScTypes.number (
DataType.Num.of_num @@ Num.num_of_int value
)