MCPcopy Create free account
hub / github.com/Snapchat/Valdi / TEST

Function TEST

valdi/test/runtime/ValueSchema_tests.cpp:42–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40};
41
42TEST(ValueSchema, supportsPrimitiveTypes) {
43 auto schema = ValueSchema::untyped();
44
45 ASSERT_TRUE(schema.isUntyped());
46 ASSERT_FALSE(schema.isString());
47 ASSERT_FALSE(schema.isOptional());
48
49 schema = ValueSchema::integer();
50
51 ASSERT_FALSE(schema.isUntyped());
52 ASSERT_TRUE(schema.isInteger());
53 ASSERT_FALSE(schema.isOptional());
54
55 schema = ValueSchema::longInteger();
56
57 ASSERT_FALSE(schema.isUntyped());
58 ASSERT_TRUE(schema.isLongInteger());
59 ASSERT_FALSE(schema.isOptional());
60
61 schema = ValueSchema::doublePrecision();
62
63 ASSERT_FALSE(schema.isUntyped());
64 ASSERT_TRUE(schema.isDouble());
65 ASSERT_FALSE(schema.isOptional());
66
67 schema = ValueSchema::boolean();
68
69 ASSERT_FALSE(schema.isUntyped());
70 ASSERT_TRUE(schema.isBoolean());
71 ASSERT_FALSE(schema.isOptional());
72
73 schema = ValueSchema::string();
74
75 ASSERT_FALSE(schema.isUntyped());
76 ASSERT_TRUE(schema.isString());
77 ASSERT_FALSE(schema.isOptional());
78}
79
80TEST(ValueSchema, supportsOptional) {
81 auto schema = ValueSchema::untyped().asOptional();

Callers

nothing calls this directly

Calls 15

EnumCaseSchemaClass · 0.85
isUntypedMethod · 0.80
isLongIntegerMethod · 0.80
asOptionalMethod · 0.80
asArrayMethod · 0.80
getArrayItemSchemaMethod · 0.80
getKeyMethod · 0.80
getParameterMethod · 0.80
isClassMethod · 0.80
isInterfaceMethod · 0.80
isEnumMethod · 0.80

Tested by

no test coverage detected