MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / test_numerics

Function test_numerics

tests/unit/test_value.c:22–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20#include "acutest.h"
21
22void test_numerics() {
23 SIValue v;
24 char const *str = "12345";
25 v = SIValue_FromString(str);
26 TEST_ASSERT(v.type == T_DOUBLE);
27 TEST_ASSERT(v.doubleval == 12345);
28
29 str = "3.14";
30 v = SIValue_FromString(str);
31 TEST_ASSERT(v.type == T_DOUBLE);
32
33 // almost equals
34 TEST_ASSERT(v.doubleval - 3.14 < 0.0001);
35
36 str = "-9876";
37 v = SIValue_FromString(str);
38 TEST_ASSERT(v.type == T_DOUBLE);
39 TEST_ASSERT(v.doubleval == -9876);
40
41 str = "+1.0E1";
42 v = SIValue_FromString(str);
43 TEST_ASSERT(v.type == T_DOUBLE);
44 TEST_ASSERT(v.doubleval == 10);
45
46 SIValue_Free(v);
47}
48
49void test_strings() {
50 SIValue v;

Callers

nothing calls this directly

Calls 2

SIValue_FromStringFunction · 0.85
SIValue_FreeFunction · 0.85

Tested by

no test coverage detected