diff options
| author | Emmanuele Bassi <ebassi@gnome.org> | 2012-10-26 10:15:35 +0100 | 
|---|---|---|
| committer | Emmanuele Bassi <ebassi@gnome.org> | 2012-10-26 11:12:58 +0100 | 
| commit | 2dec8604ee58571ccc902aeb27004adf6a436ff5 (patch) | |
| tree | 9c8485a09696ca082ec8a969aa0e08a49e880102 /json-glib/tests/parser.c | |
| parent | b9e93111a1200492b71476f7b3a1c60588a90a15 (diff) | |
| download | json-glib-2dec8604ee58571ccc902aeb27004adf6a436ff5.tar.gz | |
tests/parser: Check negative numeric values
This is the positive equivalent of the test case inside the invalid test
unit.
Diffstat (limited to 'json-glib/tests/parser.c')
| -rw-r--r-- | json-glib/tests/parser.c | 16 | 
1 files changed, 15 insertions, 1 deletions
| diff --git a/json-glib/tests/parser.c b/json-glib/tests/parser.c index 2a1ee58..3b1b049 100644 --- a/json-glib/tests/parser.c +++ b/json-glib/tests/parser.c @@ -20,6 +20,12 @@ verify_int_value (JsonNode *node)  }  static void +verify_negative_int_value (JsonNode *node) +{ +  g_assert_cmpint (-1, ==, json_node_get_int (node)); +} + +static void  verify_boolean_value (JsonNode *node)  {    g_assert_cmpint (TRUE, ==, json_node_get_boolean (node)); @@ -37,6 +43,12 @@ verify_double_value (JsonNode *node)    g_assert_cmpfloat (10.2e3, ==, json_node_get_double (node));  } +static void +verify_negative_double_value (JsonNode *node) +{ +  g_assert_cmpfloat (-3.14, ==, json_node_get_double (node)); +} +  static const struct {    const gchar *str;    JsonNodeType type; @@ -47,7 +59,9 @@ static const struct {    { "42",         JSON_NODE_VALUE, G_TYPE_INT64,   verify_int_value },    { "true",       JSON_NODE_VALUE, G_TYPE_BOOLEAN, verify_boolean_value },    { "\"string\"", JSON_NODE_VALUE, G_TYPE_STRING,  verify_string_value }, -  { "10.2e3",     JSON_NODE_VALUE, G_TYPE_DOUBLE,  verify_double_value } +  { "10.2e3",     JSON_NODE_VALUE, G_TYPE_DOUBLE,  verify_double_value }, +  { "-1",         JSON_NODE_VALUE, G_TYPE_INT64,   verify_negative_int_value }, +  { "-3.14",      JSON_NODE_VALUE, G_TYPE_DOUBLE,  verify_negative_double_value },  };  static const struct { | 
