From 9499a9f80823bf936c6b525a3fe3ae8ee8c17e80 Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Wed, 29 Oct 2014 22:20:04 -0500 Subject: Add debugging assertion --- testcases.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'testcases.c') diff --git a/testcases.c b/testcases.c index a41cd89..6526d1e 100644 --- a/testcases.c +++ b/testcases.c @@ -8,10 +8,11 @@ int buffer[MAX_SIZE]; -void assert_sorted(size_t size, cmpfun cmp) +void assert_sorted(char *base, size_t nmel, size_t width, cmpfun cmp) { - for (size_t i = 1; i < size; i++) { - if (cmp(buffer + i-1, buffer + i) > 0) abort(); + for (size_t i = 1; i < nmel; i++) { + if (cmp(base, base+width) > 0) abort(); + base += width; } } -- cgit v1.2.3