Skip to content

Commit

Permalink
A better test.
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelkgutierrez committed May 10, 2018
1 parent 0f56018 commit 486e5d7
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tests/trivial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ main(int argc, char **argv)
char *db_prefix = getenv("PWD");
if (!db_prefix) db_prefix = (char *)"/tmp";

std::string db_name = std::string(db_prefix) + "/db-name";
std::string db_name = std::string(db_prefix) + "/TEST-DB";

sdsdkv_config dkv_config = {
/* .init_comm = */
Expand Down Expand Up @@ -83,13 +83,13 @@ main(int argc, char **argv)
if (dkv_config.personality == SDSDKV_PERSONALITY_CLIENT) {
for (int i = 0; i < nkeys; ++i) {
uint64_t key = i + rank;
int value = key + 1;
uint64_t value = key + 1;
erc = sdsdkv_put(
dkvc,
(const void *)&key,
sizeof(int),
sizeof(key),
(const void *)&value,
sizeof(int)
sizeof(value)
);
if (erc != SDSDKV_SUCCESS) ABORT(rank, erc);
}
Expand All @@ -98,17 +98,19 @@ main(int argc, char **argv)
if (dkv_config.personality == SDSDKV_PERSONALITY_CLIENT) {
for (int i = 0; i < nkeys; ++i) {
uint64_t key = i + rank;
int value = -1;
uint64_t value_size = sizeof(int);
uint64_t value = -1;
uint64_t value_size = sizeof(value);
erc = sdsdkv_get(
dkvc,
(const void *)&key,
sizeof(int),
sizeof(key),
&value,
&value_size
);
if (erc != SDSDKV_SUCCESS) ABORT(rank, erc);
printf("rank=%d (key=%lu, val=%d)\n", rank, key, value);
if (value != key + 1) ABORT(rank, -1);
if (sizeof(value) != value_size) ABORT(rank, -2);
printf("rank=%d (key=%lu, val=%lu)\n", rank, key, value);
}
}
sleep(3);
Expand Down

0 comments on commit 486e5d7

Please sign in to comment.