Wed, 27 Nov 2024 23:00:07 +0100
add TODO to use a future ucx feature
423
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2022 Olaf Wintermann. All rights reserved. |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | #ifndef TEST_OBJECT_H |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | #define TEST_OBJECT_H |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | #include "../public/nsapi.h" |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | #include "test.h" |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | #ifdef __cplusplus |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | extern "C" { |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | #endif |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | UCX_TEST(test_expr_parse_expr_value); |
424
3df9258cd3cc
allow '-' in tokens, add support for negative integers
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
423
diff
changeset
|
41 | UCX_TEST(test_expr_parse_expr_neg_value); |
423
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | UCX_TEST(test_expr_parse_expr_value_str); |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | UCX_TEST(test_expr_parse_expr_value_bool); |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | UCX_TEST(test_expr_parse_expr_value_var); |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | UCX_TEST(test_expr_parse_expr_not_value); |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | UCX_TEST(test_expr_parse_expr_sign_value); |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | UCX_TEST(test_expr_parse_expr_compare2values); |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | UCX_TEST(test_expr_parse_expr_compare2value_expr); |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | UCX_TEST(test_expr_parse_expr_compare2expr_value); |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
52 | UCX_TEST(test_expr_parse_expr_bracket); |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | |
452
ce359a2b51fe
implement most nsapi expression operators
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
435
diff
changeset
|
54 | UCX_TEST(test_expr_op_defined_simple); |
ce359a2b51fe
implement most nsapi expression operators
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
435
diff
changeset
|
55 | UCX_TEST(test_expr_op_defined); |
ce359a2b51fe
implement most nsapi expression operators
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
435
diff
changeset
|
56 | UCX_TEST(test_expr_op_file_exists_simple); |
ce359a2b51fe
implement most nsapi expression operators
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
435
diff
changeset
|
57 | |
435
713ec3da79ec
expression parser: add support for functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
424
diff
changeset
|
58 | UCX_TEST(test_expr_parse_expr_func_arg0); |
713ec3da79ec
expression parser: add support for functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
424
diff
changeset
|
59 | UCX_TEST(test_expr_parse_expr_func_arg1); |
713ec3da79ec
expression parser: add support for functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
424
diff
changeset
|
60 | UCX_TEST(test_expr_parse_expr_func_arg3); |
713ec3da79ec
expression parser: add support for functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
424
diff
changeset
|
61 | UCX_TEST(test_expr_parse_expr_func_expr1); |
713ec3da79ec
expression parser: add support for functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
424
diff
changeset
|
62 | UCX_TEST(test_expr_parse_expr_func_expr2); |
713ec3da79ec
expression parser: add support for functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
424
diff
changeset
|
63 | |
713ec3da79ec
expression parser: add support for functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
424
diff
changeset
|
64 | |
423
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | #ifdef __cplusplus |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | } |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | #endif |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | #endif /* TEST_OBJECT_H */ |
bb7cff720dd0
add obj.conf expression parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 |