Skip to content

Commit

Permalink
fix test keys
Browse files Browse the repository at this point in the history
  • Loading branch information
kevyang committed Feb 22, 2017
1 parent a8ecabb commit 4d15b8b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
12 changes: 5 additions & 7 deletions test/hotkey/kc_map/check_kc_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,10 @@ test_reset(void)

START_TEST(test_basic)
{
char *key1str = "key1", *key2str = "key22";
#define KEY1 "key1"
#define KEY2 "key22"
uint32_t count;
struct bstring key1, key2;

key1.data = key1str;
key1.len = strlen(key1str);
key2.data = key2str;
key2.len = strlen(key2str);;
struct bstring key1 = str2bstr(KEY1), key2 = str2bstr(KEY2);

test_reset();

Expand All @@ -65,6 +61,8 @@ START_TEST(test_basic)
kc_map_decr(&key1);
count = kc_map_incr(&key1);
ck_assert_int_eq(count, 2);
#undef KEY1
#undef KEY2
}
END_TEST

Expand Down
25 changes: 11 additions & 14 deletions test/hotkey/key_window/check_key_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,10 @@ test_reset(void)

START_TEST(test_basic)
{
char *key1str = "key1";
#define KEY1 "key1"
struct bstring key1 = str2bstr(KEY1);
char buf[MAX_KEY_LEN];
uint32_t key_window_pop_len;
struct bstring key1;

key1.data = key1str;
key1.len = strlen(key1str);

test_reset();

Expand All @@ -62,22 +59,19 @@ START_TEST(test_basic)
ck_assert_int_eq(key_window_len(), 0);
ck_assert_int_eq(key_window_pop_len, key1.len);
ck_assert(strncmp(key1.data, buf, key1.len) == 0);
#undef KEY1
}
END_TEST

START_TEST(test_multiple)
{
char *key1str = "key1", *key2str = "key22", *key3str = "key333";
#define KEY1 "key1"
#define KEY2 "key22"
#define KEY3 "key333"
char buf[MAX_KEY_LEN];
uint32_t key_window_pop_len;
struct bstring key1, key2, key3;

key1.data = key1str;
key1.len = strlen(key1str);
key2.data = key2str;
key2.len = strlen(key2str);
key3.data = key3str;
key3.len = strlen(key3str);
struct bstring key1 = str2bstr(KEY1), key2 = str2bstr(KEY2),
key3 = str2bstr(KEY3);

test_reset();

Expand All @@ -102,6 +96,9 @@ START_TEST(test_multiple)
ck_assert_int_eq(key_window_pop_len, key3.len);
ck_assert(strncmp(key3.data, buf, key3.len) == 0);
ck_assert_int_eq(key_window_len(), 0);
#undef KEY1
#undef KEY2
#undef KEY3
}
END_TEST

Expand Down

0 comments on commit 4d15b8b

Please sign in to comment.