aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/unit_tests/parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit_tests/parser.cpp')
-rw-r--r--test/unit_tests/parser.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/unit_tests/parser.cpp b/test/unit_tests/parser.cpp
index 562c6b7..37d9e0a 100644
--- a/test/unit_tests/parser.cpp
+++ b/test/unit_tests/parser.cpp
@@ -30,6 +30,10 @@ const std::vector<std::string_view> input{
" 2 * (1 + 3) ",
" 2 * (1 + 3 * (1 - -3)) ",
" -2 * ---- (3 + -100e-1) ", // Looks weird, but also works in e.g. Python
+ "2 ^ 3 ^ 3",
+ "(2 ^ 3) ^ 3", // Power operator is right-associative
+ "(.5 ^ -1) ^ 4",
+ ".5 ^ -1 ^ 4", // Power operator has higher precedence than the unary minus
};
const std::vector<double> expected{
@@ -39,6 +43,10 @@ const std::vector<double> expected{
8,
26,
14,
+ 134217728,
+ 512,
+ 16,
+ 2,
};
}