3 comments:
Patch Set #1, Line 37: TEST_LDFLAGS = -lcmocka
You're not using any of the actual function mocking features of cmocka in your example, btw. […]
You should definitely add at least one mock function to the example code.
Patch Set #1, Line 13: {"is\0very", 2},
Maybe add a comment that strlen is only 2 because of the embedded \0 character?
/* Below will fail the test */
size = strlen(NULL);
In general, taking strlen of NULL (or str-anything of NULL) is a bad idea.
Please explain how it fails the test. Does it return a non-zero value? Does it coredump? If it coredumps, what does Cmocka do? Can you have Cmocka catch the coredump as an expected result (like GoogleTest's DEATH tests)?
To view, visit change 39894. To unsubscribe, or for help writing mail filters, visit settings.