Skip to content

Commit

Permalink
Add optional property-based tests, using theft (if available).
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Vokes committed Sep 19, 2014
1 parent c565a44 commit 555f7cf
Show file tree
Hide file tree
Showing 3 changed files with 539 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,24 @@ CFLAGS += -Wmissing-prototypes
CFLAGS += -Wstrict-prototypes
CFLAGS += -Wmissing-declarations

# If libtheft is available, build additional property-based tests.
# Uncomment these to use it in test_heatshrink_dynamic.
#CFLAGS += -DHEATSHRINK_HAS_THEFT
#LDFLAGS += -ltheft

all:
@echo "For tests, make test_heatshrink_dynamic (default) or change the"
@echo "config.h to disable static memory and build test_heatshrink_static."
@echo "For the standalone command-line tool, make heatshrink."

${PROJECT}: heatshrink.c

heatshrink: heatshrink_encoder.o heatshrink_decoder.o
test_heatshrink_dynamic: heatshrink_encoder.o heatshrink_decoder.o
test_heatshrink_static: heatshrink_encoder.o heatshrink_decoder.o
OBJS= heatshrink_encoder.o \
heatshrink_decoder.o \

heatshrink: ${OBJS}
test_heatshrink_dynamic: ${OBJS} test_heatshrink_dynamic_theft.o
test_heatshrink_static: ${OBJS}

*.o: Makefile heatshrink_config.h

Expand Down
7 changes: 7 additions & 0 deletions test_heatshrink_dynamic.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ SUITE(encoding);
SUITE(decoding);
SUITE(integration);

#ifdef HEATSHRINK_HAS_THEFT
SUITE(properties);
#endif

static void dump_buf(char *name, uint8_t *buf, uint16_t count) {
for (int i=0; i<count; i++) {
uint8_t c = (uint8_t)buf[i];
Expand Down Expand Up @@ -988,5 +992,8 @@ int main(int argc, char **argv) {
RUN_SUITE(encoding);
RUN_SUITE(decoding);
RUN_SUITE(integration);
#ifdef HEATSHRINK_HAS_THEFT
RUN_SUITE(properties);
#endif
GREATEST_MAIN_END(); /* display results */
}
Loading

0 comments on commit 555f7cf

Please sign in to comment.