Skip to content

Commit ae9741e

Browse files
committed
Add demo output comparison step to CI
1 parent b6ca9bd commit ae9741e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.github/workflows/c-cpp.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ jobs:
4141
working-directory: ./build
4242
run: ./demo_cpp
4343

44+
- name: Compare demo outputs
45+
run: |
46+
./demo > output1.txt
47+
./demo_cpp > output2.txt
48+
if ! diff -q output1.txt output2.txt; then
49+
echo "Outputs differ!"
50+
diff output1.txt output2.txt
51+
exit 1
52+
fi
53+
4454
- name: Run Tests
4555
working-directory: ./build
4656
run: ./json_parser_tests

demo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ int main()
5151
break;
5252

5353
case JSON_TOKEN_NUMBER:
54-
printf("Number: %f\n", t->value.number);
54+
printf("Number: %g\n", t->value.number);
5555
break;
5656

5757
case JSON_TOKEN_TRUE:

0 commit comments

Comments
 (0)