Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
tests/fixtures
tests/test
tests/results
*.swp
5 changes: 4 additions & 1 deletion tests/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <pthread.h>
#include <assert.h>
#include "mode-s.h"
#include <time.h>

#define MODE_S_DATA_LEN (16*16384) // 256k
#define MODE_S_PREAMBLE_US 8 // microseconds
Expand Down Expand Up @@ -79,9 +80,11 @@ void test(mode_s_t *self, struct mode_s_msg *mm) {
MODE_S_NOTUSED(self);
int j;

char *msg = (char*)malloc(mm->msgbits/4 * sizeof(char));
char *msg = (char*)malloc(mm->msgbits/4 * sizeof(char) + 1);
memset(msg, 0x00, mm->msgbits/4 * sizeof(char) + 1);
for (j = 0; j < mm->msgbits/8; j++) sprintf(&msg[j*2], "%02x", mm->msg[j]);
printf("validating message #%d\n", msgNo + 1);
fflush(stdout);

assert(strcmp(msg, messages[msgNo++]) == 0);
}
Expand Down