55 UCX_TEST_END; |
55 UCX_TEST_END; |
56 |
56 |
57 pool_destroy(pool); |
57 pool_destroy(pool); |
58 } |
58 } |
59 |
59 |
|
60 UCX_TEST(test_expr_parse_expr_neg_value) { |
|
61 pool_handle_t *pool = pool_create(); |
|
62 |
|
63 CxList *tokens = cxLinkedListCreate(pool_allocator(pool), cx_cmp_ptr, sizeof(cxstring)); |
|
64 cxstring token = cx_str("-123"); |
|
65 cxListAdd(tokens, &token); |
|
66 |
|
67 UCX_TEST_BEGIN; |
|
68 |
|
69 size_t pos = 0; |
|
70 NSAPIExpression *expr = expr_parse_logical_expr(pool, tokens, &pos); |
|
71 |
|
72 UCX_TEST_ASSERT(pos == 1, "wrong token pos"); |
|
73 UCX_TEST_ASSERT(expr, "expression is null"); |
|
74 UCX_TEST_ASSERT(expr->type == NSAPI_EXPRESSION_INT, "wrong type"); |
|
75 UCX_TEST_ASSERT(expr->value.i == -123, "wrong value"); |
|
76 |
|
77 UCX_TEST_END; |
|
78 |
|
79 pool_destroy(pool); |
|
80 } |
|
81 |
60 UCX_TEST(test_expr_parse_expr_value_str) { |
82 UCX_TEST(test_expr_parse_expr_value_str) { |
61 pool_handle_t *pool = pool_create(); |
83 pool_handle_t *pool = pool_create(); |
62 |
84 |
63 CxList *tokens = cxLinkedListCreate(pool_allocator(pool), cx_cmp_ptr, sizeof(cxstring)); |
85 CxList *tokens = cxLinkedListCreate(pool_allocator(pool), cx_cmp_ptr, sizeof(cxstring)); |
64 cxstring token = cx_str("\"hello world\""); |
86 cxstring token = cx_str("\"hello world\""); |