Skip to content

Commit 7e2fb89

Browse files
committed
add check code for #14
1 parent e1a3dd1 commit 7e2fb89

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ test-with-cpp11: test/test.cpp timsort.hpp .bin
2828
$(COMPILE) -std=c++11 $< $(LIB_BOOST_TEST) -o .bin/$@
2929
time ./.bin/$@
3030

31+
test-issue14: valgrind/issue14.cpp
32+
$(COMPILE) -std=c++11 $< -o .bin/$@
33+
valgrind ./.bin/$@
34+
3135
bench: example/bench.cpp timsort.hpp .bin
3236
$(CXX) -v
3337
$(COMPILE) $(OPTIMIZE) -std=c++11 $< -o .bin/$@

valgrind/issue14.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include "timsort.hpp"
2+
#include <deque>
3+
#include <cstdlib>
4+
5+
int main() {
6+
std::deque<int> collection = {15, 7, 16, 20, 25, 28, 13, 27, 34, 24, 19, 1, 6, 30, 32, 29, 10, 9,
7+
3, 31, 21, 26, 8, 2, 22, 14, 4, 12, 5, 0, 23, 33, 11, 17, 18};
8+
9+
gfx::timsort(std::begin(collection), std::end(collection));
10+
assert(std::is_sorted(std::begin(collection), std::end(collection)));
11+
12+
return 0;
13+
}

0 commit comments

Comments
 (0)