Adapt tests to show that floats work properly.

This commit is contained in:
Christian Theune 2016-01-06 10:03:24 +01:00
parent b4bda4765a
commit 5cdcaf5e8e
7 changed files with 23 additions and 3 deletions

View file

@ -12,7 +12,9 @@ builtins.fromJSON
"Width": 100 "Width": 100
}, },
"Animated" : false, "Animated" : false,
"IDs": [116, 943, 234, 38793, true ,false,null, -100] "IDs": [116, 943, 234, 38793, true ,false,null, -100],
"Latitude": 37.7668,
"Longitude": -122.3959,
} }
} }
'' ''
@ -28,5 +30,7 @@ builtins.fromJSON
}; };
Animated = false; Animated = false;
IDs = [ 116 943 234 38793 true false null (0-100) ]; IDs = [ 116 943 234 38793 true false null (0-100) ];
Latitude = 37.7668;
Longitude = -122.3959;
}; };
} }

View file

@ -1 +1 @@
"{\"a\":123,\"b\":-456,\"c\":\"foo\",\"d\":\"foo\\n\\\"bar\\\"\",\"e\":true,\"f\":false,\"g\":[1,2,3],\"h\":[\"a\",[\"b\",{\"foo\\nbar\":{}}]],\"i\":3}" "{\"a\":123,\"b\":-456,\"c\":\"foo\",\"d\":\"foo\\n\\\"bar\\\"\",\"e\":true,\"f\":false,\"g\":[1,2,3],\"h\":[\"a\",[\"b\",{\"foo\\nbar\":{}}]],\"i\":3,\"j\":1.44}"

View file

@ -8,4 +8,5 @@ builtins.toJSON
g = [ 1 2 3 ]; g = [ 1 2 3 ];
h = [ "a" [ "b" { "foo\nbar" = {}; } ] ]; h = [ "a" [ "b" { "foo\nbar" = {}; } ] ];
i = 1 + 2; i = 1 + 2;
j = 1.44;
} }

View file

@ -1 +1 @@
[ true false true false true false true false true false true false "int" "bool" "string" "null" "set" "list" "lambda" "lambda" "lambda" "lambda" ] [ true false true false true false true false true true true true true true true true true true true false true false "int" "bool" "string" "null" "set" "list" "lambda" "lambda" "lambda" "lambda" ]

View file

@ -8,6 +8,16 @@ with builtins;
(isString [ "x" ]) (isString [ "x" ])
(isInt (1 + 2)) (isInt (1 + 2))
(isInt { x = 123; }) (isInt { x = 123; })
(isInt (1 / 2))
(isInt (1 + 1))
(isInt (1 / 2))
(isInt (1 * 2))
(isInt (1 - 2))
(isFloat (1.2))
(isFloat (1 + 1.0))
(isFloat (1 / 2.0))
(isFloat (1 * 2.0))
(isFloat (1 - 2.0))
(isBool (true && false)) (isBool (true && false))
(isBool null) (isBool null)
(isAttrs { x = 123; }) (isAttrs { x = 123; })

View file

@ -45,5 +45,8 @@
<attr name="x"> <attr name="x">
<int value="123" /> <int value="123" />
</attr> </attr>
<attr name="y">
<float value="567.89" />
</attr>
</attrs> </attrs>
</expr> </expr>

View file

@ -2,6 +2,8 @@ rec {
x = 123; x = 123;
y = 567.890;
a = "foo"; a = "foo";
b = "bar"; b = "bar";