Blender V5.3
BLI_expr_pylike_eval_test.cc File Reference
#include "testing/testing.h"
#include <cstring>
#include "BLI_expr_pylike_eval.hh"
#include "BLI_math_base_c.hh"
#include "BLI_utildefines.hh"

Go to the source code of this file.

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define TRUE_VAL   1.0
#define FALSE_VAL   0.0
#define TEST_PARSE_FAIL(name, str)
#define TEST_CONST(name, str, value)
#define TEST_RESULT(name, str, value)
#define TEST_EVAL(name, str, x, value)
#define TEST_ERROR(name, str, x, code)

Functions

static void blender::expr_pylike_parse_fail_test (const char *str)
static void blender::expr_pylike_const_test (const char *str, double value, bool force_const)
static ExprPyLike_Parsed * blender::parse_for_eval (const char *str, bool nonconst)
static void blender::verify_eval_result (ExprPyLike_Parsed *expr, double x, double value)
static void blender::expr_pylike_eval_test (const char *str, double x, double value)
static void blender::expr_pylike_error_test (const char *str, double x, eExprPyLike_EvalStatus error)
 blender::TEST (expr_pylike, Eval_Ternary1)
 blender::TEST (expr_pylike, MultipleArgs)
 blender::TEST (expr_pylike, UsingParam)
 blender::TEST_ERROR (Mixed1, "sqrt(x) + 1 / max(0, x)", -1.0, EXPR_PYLIKE_MATH_ERROR) TEST_ERROR(Mixed2
 blender::sqrt (x)+1/max(0
EXPR_PYLIKE_DIV_BY_ZERO blender::TEST_ERROR (Mixed3, "sqrt(x) + 1 / max(0, x)", 1.0, EXPR_PYLIKE_SUCCESS) TEST(expr_pylike
 blender::EXPECT_EQ (BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
 blender::BLI_expr_pylike_free (expr)
 blender::TEST (expr_pylike, Error_ArgumentCount)

Variables

 blender::x
EXPR_PYLIKE_DIV_BY_ZERO blender::Error_Invalid
double blender::result

Macro Definition Documentation

◆ FALSE_VAL

#define FALSE_VAL   0.0

Definition at line 16 of file BLI_expr_pylike_eval_test.cc.

◆ TEST_CONST

#define TEST_CONST ( name,
str,
value )
Value:
TEST(expr_pylike, Const_##name) \
{ \
expr_pylike_const_test(str, value, true); \
}
#define str(s)
#define TEST(a, b)

Definition at line 121 of file BLI_expr_pylike_eval_test.cc.

◆ TEST_ERROR

#define TEST_ERROR ( name,
str,
x,
code )
Value:
TEST(expr_pylike, Error_##name) \
{ \
expr_pylike_error_test(str, x, code); \
}

Definition at line 327 of file BLI_expr_pylike_eval_test.cc.

◆ TEST_EVAL

#define TEST_EVAL ( name,
str,
x,
value )
Value:
TEST(expr_pylike, Eval_##name) \
{ \
expr_pylike_eval_test(str, x, value); \
}

Definition at line 135 of file BLI_expr_pylike_eval_test.cc.

◆ TEST_PARSE_FAIL

#define TEST_PARSE_FAIL ( name,
str )
Value:
TEST(expr_pylike, ParseFail_##name) \
{ \
expr_pylike_parse_fail_test(str); \
}

Definition at line 90 of file BLI_expr_pylike_eval_test.cc.

◆ TEST_RESULT

#define TEST_RESULT ( name,
str,
value )
Value:
TEST(expr_pylike, Result_##name) \
{ \
expr_pylike_const_test(str, value, false); \
}

Definition at line 128 of file BLI_expr_pylike_eval_test.cc.

◆ TRUE_VAL

#define TRUE_VAL   1.0

Definition at line 15 of file BLI_expr_pylike_eval_test.cc.