summaryrefslogtreecommitdiff
path: root/json-c/src/tests/test_charcase.c
diff options
context:
space:
mode:
authorMichał Cichoń <michcic@gmail.com>2015-08-25 19:56:24 +0200
committerMichał Cichoń <michcic@gmail.com>2015-08-25 19:56:24 +0200
commit682f23e7bb4a52bedf46eff5c4859e1308eda124 (patch)
tree30ad4f37b434ecdfb5edc36dfbaf7fc924e53c0e /json-c/src/tests/test_charcase.c
parent8b41fc907bcd27d24c895062ae8a61b305fc2d46 (diff)
downloadpianobar-windows-build-682f23e7bb4a52bedf46eff5c4859e1308eda124.tar.gz
pianobar-windows-build-682f23e7bb4a52bedf46eff5c4859e1308eda124.tar.bz2
pianobar-windows-build-682f23e7bb4a52bedf46eff5c4859e1308eda124.zip
Update build ref
Diffstat (limited to 'json-c/src/tests/test_charcase.c')
-rw-r--r--json-c/src/tests/test_charcase.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/json-c/src/tests/test_charcase.c b/json-c/src/tests/test_charcase.c
new file mode 100644
index 0000000..9179467
--- /dev/null
+++ b/json-c/src/tests/test_charcase.c
@@ -0,0 +1,40 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <string.h>
+#include <assert.h>
+
+#include "json.h"
+#include "json_tokener.h"
+
+static void test_case_parse(void);
+
+int main(int argc, char **argv)
+{
+ MC_SET_DEBUG(1);
+
+ test_case_parse();
+}
+
+/* make sure only lowercase forms are parsed in strict mode */
+static void test_case_parse()
+{
+ struct json_tokener *tok;
+ json_object *new_obj;
+
+ tok = json_tokener_new();
+ json_tokener_set_flags(tok, JSON_TOKENER_STRICT);
+
+ new_obj = json_tokener_parse_ex(tok, "True", 4);
+ assert (new_obj == NULL);
+
+ new_obj = json_tokener_parse_ex(tok, "False", 5);
+ assert (new_obj == NULL);
+
+ new_obj = json_tokener_parse_ex(tok, "Null", 4);
+ assert (new_obj == NULL);
+
+ printf("OK\n");
+
+ json_tokener_free(tok);
+}