awtk/tests/expr_test.cc
2019-01-26 17:35:16 +08:00

11 lines
273 B
C++

#include "tkc/expr_eval.h"
#include "gtest/gtest.h"
TEST(ExprEval, basic) {
ASSERT_EQ(1, tk_expr_eval("1"));
ASSERT_EQ(2, tk_expr_eval("1 + 1"));
ASSERT_EQ(2, tk_expr_eval("1 * 2"));
ASSERT_EQ(2, tk_expr_eval("4/2"));
ASSERT_EQ(4, tk_expr_eval("(1+1)*2"));
}