Skip to content

Commit 60bc626

Browse files
author
strangeCamel
committed
add some autotests
1 parent f15d8dc commit 60bc626

27 files changed

+549
-8
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
strange
1+
_results
2+

Makefile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
SRC_FILES:= $(wildcard src/*)
22
VERINFO:= $(shell git log -1 --format="%h %cd" || date)
3+
STRANGE:=_results/strange
34

4-
strange: $(SRC_FILES)
5-
$(CXX) $(CXX_FLAGS) -std=c++17 -O2 -DVERINFO="\"$(VERINFO)\"" -Isrc src/strange.cpp -o strange #-DSTRINGS_INTERNING
5+
$(STRANGE): $(SRC_FILES)
6+
mkdir -p _results
7+
$(CXX) $(CXX_FLAGS) -std=c++17 -O2 -DVERINFO="\"$(VERINFO)\"" -Isrc src/strange.cpp -o $(STRANGE) #-DSTRINGS_INTERNING
8+
9+
test: $(STRANGE) test/test.sh
10+
cd test && time ./test.sh
611

712
clean:
8-
rm -f strange
13+
rm -rf _results
914

10-
install: strange scripts
11-
install strange /usr/local/bin/
15+
install: $(STRANGE) scripts
16+
install $(STRANGE) /usr/local/bin/
1217
install scripts/strange-* /usr/local/bin/
1318

14-
.PHONY: clean
15-
19+
.PHONY: clean test

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ BSD 3-clause license.<br>
99
* Can be compiled in C++14 too, but in this case performance will be degraded.
1010
* No extra dependencies - needs only C++-capable compiler and make.
1111
* To build, run: `make`
12+
* To test, run: `make test`
1213
* To install, run: `sudo make install`
1314

1415
##### Using

test/01-Simple/eval-match

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
hello sun
2+
hello people
3+
hello world
4+
goodbye sun
5+
goodbye people
6+
goodbye world

test/01-Simple/eval-mismatch

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
hello sunday
2+
hello moon
3+
hello pose
4+
hello kitty
5+
goodbye sunday
6+
goodbye moon
7+
goodbye pose
8+
goodbye kitty

test/01-Simple/sample.1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
hello sun
2+
hello people
3+
hello world

test/01-Simple/sample.2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
goodbye sun
2+
goodbye people
3+
goodbye world

test/02-Numbers/eval-match

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
hello 1 sun
2+
hello 2 sun
3+
hello 3 sun
4+
hello 4 sun
5+
hello 5 sun
6+
hello 6 sun
7+
hello 7 sun
8+
hello 8 sun
9+
hello 9 sun
10+
hello 0 sun
11+
12+
goodbye 1 people
13+
goodbye 22 people
14+
goodbye 333 people
15+
goodbye 4444 people
16+
goodbye 55555 people
17+
18+
goodbye 2 people
19+
goodbye 33 people
20+
goodbye 444 people
21+
goodbye 5555 people
22+
goodbye 66666 people
23+
24+
goodbye 777777 people
25+
goodbye 7777778 people
26+
27+
this is hex: 0x123
28+
this is hex: 0x321
29+
this is hex: 0xabc
30+
this is hex: 0xdef
31+
32+
this is hex: 0x111
33+
this is hex: 0x323
34+
this is hex: 0xcab
35+
this is hex: 0xfde
36+
37+
this is diverse hex: 0x123
38+
this is diverse hex: 0x32
39+
this is diverse hex: 0xab
40+
this is diverse hex: 0xd
41+
42+
this is diverse hex: 0x111
43+
this is diverse hex: 0x32
44+
this is diverse hex: 0xca
45+
this is diverse hex: 0xf
46+
47+
this is diverse hex: 0x111111
48+
this is diverse hex: 0x32323
49+
this is diverse hex: 0xcaca
50+

test/02-Numbers/eval-mismatch

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
hello 1111 sun
2+
hello 222 sun
3+
hello 33 sun
4+
hello 44 sun
5+
hello n sun
6+
hello sun
7+
8+
goodbye people
9+
goodbye x people
10+
goodbye xx people
11+
goodbye xxx people
12+
goodbye xxxx people
13+
goodbye xxxxx people
14+
15+
16+
this is hex: 0z123
17+
this is hex: 0x3z3
18+
this is hex: 0x55
19+
this is hex:
20+
21+
this is diverse hex: 0x123333333333333333
22+
this is diverse hex:
23+
this is diverse hex: abz

test/02-Numbers/sample.1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
hello 1 sun
2+
hello 2 sun
3+
hello 3 sun
4+
hello 4 sun
5+
hello 5 sun
6+
7+
goodbye 1 people
8+
goodbye 22 people
9+
goodbye 333 people
10+
goodbye 4444 people
11+
goodbye 55555 people
12+
13+
this is hex: 0x123
14+
this is hex: 0x321
15+
this is hex: 0xabc
16+
this is hex: 0xdef
17+
18+
this is diverse hex: 0x123
19+
this is diverse hex: 0x32
20+
this is diverse hex: 0xab
21+
this is diverse hex: 0xd

0 commit comments

Comments
 (0)