Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //NEW
- UNIT_TEST(add_msg_and_read_label){
- UNIT_TEST_BEGIN();
- init_json_decoder("[{\"bn\": \"urn:mac:testID\"}]");
- add_new_msg("[{\"u\": \"dB\"}]");
- struct pair lv;
- read_next_token(&lv);
- read_next_token(&lv);
- UNIT_TEST_ASSERT(strcmp(lv.label, "u") == 0);
- UNIT_TEST_END();
- }
- UNIT_TEST(add_msg_and_read_value_str){
- UNIT_TEST_BEGIN();
- init_json_decoder("[{\"bn\": \"urn:mac:testID\"}]");
- add_new_msg("[{\"u\": \"dB\"}]");
- struct pair lv;
- read_next_token(&lv);
- read_next_token(&lv);
- UNIT_TEST_ASSERT(strcmp(lv.label, "dB") == 0);
- UNIT_TEST_END();
- }
- UNIT_TEST(add_msg_and_read_value_int){
- UNIT_TEST_BEGIN();
- init_json_decoder("[{\"bn\": \"urn:mac:testID\"}]");
- add_new_msg("[{\"v\": 10}]");
- struct pair lv;
- read_next_token(&lv);
- read_next_token(&lv);
- UNIT_TEST_ASSERT(lv.value == 10);
- UNIT_TEST_END();
- }
- UNIT_TEST(read_add_read_label){
- UNIT_TEST_BEGIN();
- init_json_decoder("[{\"bn\": \"urn:mac:testID\"}]");
- struct pair lv;
- read_next_token(&lv);
- add_new_msg("[{\"v\": 10}]");
- read_next_token(&lv);
- UNIT_TEST_ASSERT(strcmp(lv.label, "v") == 0);
- UNIT_TEST_END();
- }
- UNIT_TEST(read_add_read_value_str){
- UNIT_TEST_BEGIN();
- init_json_decoder("[{\"bn\": \"urn:mac:testID\"}]");
- struct pair lv;
- read_next_token(&lv);
- add_new_msg("[{\"u\": \"dB\"}]");
- read_next_token(&lv);
- UNIT_TEST_ASSERT(strcmp(lv.label, "dB") == 0);
- UNIT_TEST_END();
- }
- UNIT_TEST(read_add_read_value_int){
- UNIT_TEST_BEGIN();
- init_json_decoder("[{\"bn\": \"urn:mac:testID\"}]");
- struct pair lv;
- read_next_token(&lv);
- add_new_msg("[{\"v\": 10}]");
- read_next_token(&lv);
- UNIT_TEST_ASSERT(lv.value == 10);
- UNIT_TEST_END();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement