Skip to content

Commit

Permalink
Add more tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
kosarev committed Jun 6, 2019
1 parent c477235 commit db2aae4
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
13 changes: 12 additions & 1 deletion c/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
all: escapeless

test: test_moby test_all_bytes test_one_missed
test: \
test_all_bytes \
test_moby \
test_one_missed \
test_other_unused_takeout \
test_unused_takeout

LIB_HEADER = escapeless.h
LIB_SRC = escapeless.c
Expand All @@ -25,6 +30,12 @@ test_moby: tester
test_all_bytes: tester
./tester <$(TESTS)/all_bytes.test

test_unused_takeout: tester
./tester <$(TESTS)/unused_takeout.test

test_other_unused_takeout: tester
./tester <$(TESTS)/other_unused_takeout.test

test_one_missed: tester
./escapeless encode AB <$(TESTS)/one_missed.bin | diff - $(TESTS)/one_missed.bin.encoded
./escapeless decode AB <$(TESTS)/one_missed.bin.encoded | diff - $(TESTS)/one_missed.bin
Expand Down
2 changes: 1 addition & 1 deletion tests/all_bytes.test
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# A block that uses as much bytes as it can; with a used takeout.
# A block that uses as much bytes as it can.

# Input block.
00..fd
Expand Down
13 changes: 13 additions & 0 deletions tests/other_unused_takeout.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# A block that uses as much bytes as it can; with an unused
# takeout, but this time pick the other one.

# Input block.
00..fd

# Takeouts.
ff

# Encoded block. The takeout has to be mapped to an unused, which
# is now 0xfe.
fe 00..fd
12 changes: 12 additions & 0 deletions tests/unused_takeout.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# A block that uses as much bytes as it can; with an unused
# takeout.

# Input block.
00..fd

# Takeouts.
fe

# Encoded block.
ff 00..fd

0 comments on commit db2aae4

Please sign in to comment.