Skip to content

Commit

Permalink
Fixed issue #126: We are not assuming anymore that char is signed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martinsos committed Jan 20, 2019
1 parent 26a4377 commit 6ae86da
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/runTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <climits>

#include "edlib.h"
#include "SimpleEditDistance.h"
Expand Down Expand Up @@ -412,8 +413,10 @@ bool test10() {
bool test11() {
int queryLength = 8;
int targetLength = 8;
char query[8] = {-127, 127, -55, 0, 42, 0, 127, -55};
char target[8] = {-127, 127, 0, 42, 0, -55, 127, 42};
// NOTE(Martin): I am using CHAR_MIN and CHAR_MAX because 'char' type is not guaranteed to be
// signed or unsigned by compiler, we can't know if it is signed or unsigned.
char query[8] = {CHAR_MIN, CHAR_MIN + (CHAR_MAX - CHAR_MIN) / 2, CHAR_MAX};
char target[8] = {CHAR_MIN, CHAR_MIN + (CHAR_MAX - CHAR_MIN) / 2 + 1, CHAR_MAX};

bool r = executeTest(query, queryLength, target, targetLength, EDLIB_MODE_HW);
r = r && executeTest(query, queryLength, target, targetLength, EDLIB_MODE_NW);
Expand Down

0 comments on commit 6ae86da

Please sign in to comment.