Skip to content

Commit 80d384e

Browse files
committed
test: expect changes gt0 only when not initializing the db
1 parent 2c95976 commit 80d384e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
*.a
1111
unittest
1212
/curl/src
13+
.vscode

test/main.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "sqlite3.h"
1313
#include <pthread.h>
1414

15-
#define PEERS 2
15+
#define PEERS 150
1616
#define DB_PATH "health-track.sqlite"
1717
#define EXT_PATH "./dist/cloudsync"
1818
#define RCHECK if (rc != SQLITE_OK) goto abort_test;
@@ -194,10 +194,10 @@ int test_init (const char *db_path, int init) {
194194
rc = db_expect_int(db, "SELECT COUNT(*) as count FROM users;", 1); RCHECK
195195
if(init){
196196
rc = db_exec(db, "SELECT cloudsync_network_sync();"); RCHECK
197-
rc = db_expect_gt0(db, "SELECT COUNT(*) as count FROM users;"); RCHECK //tofix
198-
rc = db_expect_gt0(db, "SELECT COUNT(*) as count FROM activities;"); RCHECK //tofix
199-
} else {
197+
} else { //tofix
200198
rc = db_expect_gt0(db, "SELECT cloudsync_network_sync();"); RCHECK
199+
rc = db_expect_gt0(db, "SELECT COUNT(*) as count FROM users;"); RCHECK
200+
rc = db_expect_gt0(db, "SELECT COUNT(*) as count FROM activities;"); RCHECK
201201
}
202202
rc = db_expect_int(db, "SELECT COUNT(*) as count FROM workouts;", 0); RCHECK
203203
rc = db_exec(db, "SELECT cloudsync_terminate();");
@@ -267,9 +267,9 @@ void* worker(void* arg) {
267267
int thread_id = *(int*)arg;
268268

269269
char description[32];
270-
snprintf(description, sizeof(description), "%d/%d Peer Test", thread_id, PEERS);
270+
snprintf(description, sizeof(description), "%d/%d Peer Test", thread_id+1, PEERS);
271271
if(test_report(description, test_init(":memory:", 1))){
272-
printf("PEER %d FAIL.\n", thread_id);
272+
printf("PEER %d FAIL.\n", thread_id+1);
273273
exit(thread_id+1);
274274
}
275275

0 commit comments

Comments
 (0)