zserge / jsmn

Jsmn is a world fastest JSON parser/tokenizer. This is the official repo replacing the old one at Bitbucket
MIT License
3.65k stars 778 forks source link

`make test` fails #56

Closed vivien closed 8 years ago

vivien commented 8 years ago

As of 2db0378, 3 tests fail:

$ make test
cc   test/tests.c -o test/test_default
./test/test_default
FAILED: test for a JSON arrays (at line 75)
FAILED: test string JSON data types (at line 136)
FAILED: test issue #22 (at line 270)

PASSED: 11
FAILED: 3

BTW, do you have a release method? some stable tag or branch?

zserge commented 8 years ago

Oh, that's interesting. Which compiler/system/architecture do you use? On my hosts the tip revision looks fine:

cc   test/tests.c -o test/test_default
./test/test_default

PASSED: 14
FAILED: 0
cc -DJSMN_STRICT=1   test/tests.c -o test/test_strict
./test/test_strict

PASSED: 14
FAILED: 0
cc -DJSMN_PARENT_LINKS=1   test/tests.c -o test/test_links
./test/test_links

PASSED: 14
FAILED: 0
cc -DJSMN_STRICT=1 -DJSMN_PARENT_LINKS=1   test/tests.c -o test/test_strict_links
./test/test_strict_links

PASSED: 14
FAILED: 0

Also, unfortunately, there is no releases nor tags - in the past I simply copied the "most recent" jsmn.c and jsmn.h into each project due to the lack of package management in embedded C. So I'm not sure whether it's too late to introduce versioning now - no new features are planned for JSMN, only bug fixes so the "tip" should work fine for most use cases.

vivien commented 8 years ago

Sorry for the lack of information:

/m/d/s/jsmn (master) $ gcc --version
gcc (GCC) 5.2.0

/m/d/s/jsmn (master) $ uname -a
Linux ketchup 4.2.4-1-ARCH #1 SMP PREEMPT Fri Oct 23 07:32:38 CEST 2015 x86_64 GNU/Linux

So I'm not sure whether it's too late to introduce versioning now - no new features are planned for JSMN, only bug fixes so the "tip" should work fine for most use cases.

Maybe my issues are a special case. But I think it's never too late, the user of the library must have a clue whether (s)he's using a dev or stable version. You may not plan new features, but who knows ;-) I see 2 options here, either tag known to be stable commits, or having a "dev" branch. Given your usecase, I think the former is too heavy. Expecting the "master" branch to be stable and pushing new feature (or "need to be heavily tested changes") to a "dev" branch, seems more appropriate.

zserge commented 8 years ago

Ok, looks like some tests expecting the parsing failure don't return "1". I suspect the ok variable to be uninitialized, fixed that. Can you please try your tests with the tip version once again? If they still fail - may I ask you to add some printf statements to tell me what is the returned value of parse?

vivien commented 8 years ago
/m/d/s/jsmn (master) $ git rev-parse --short HEAD
076abdd
/m/d/s/jsmn (master) $ make clean 
rm -f jsmn.o jsmn_test.o example/simple.o
rm -f libjsmn.a
rm -f simple_example
rm -f jsondump
/m/d/s/jsmn (master) $ make test
cc   test/tests.c -o test/test_default
./test/test_default

PASSED: 14
FAILED: 0
cc -DJSMN_STRICT=1   test/tests.c -o test/test_strict
./test/test_strict

PASSED: 14
FAILED: 0
cc -DJSMN_PARENT_LINKS=1   test/tests.c -o test/test_links
./test/test_links

PASSED: 14
FAILED: 0
cc -DJSMN_STRICT=1 -DJSMN_PARENT_LINKS=1   test/tests.c -o test/test_strict_links
./test/test_strict_links

PASSED: 14
FAILED: 0

Thanks!