MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / TEST

Function TEST

source/test/item_test.cpp:9–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7using namespace Star;
8
9TEST(ItemTest, ItemDescriptorConstruction) {
10 ItemDescriptor testItemDescriptor;
11
12 testItemDescriptor = ItemDescriptor();
13
14 testItemDescriptor = ItemDescriptor(Json());
15
16 String nameOnly = "perfectlygenericitem";
17 testItemDescriptor = ItemDescriptor(nameOnly);
18
19 List<JsonArray> arrayFormats = List<JsonArray>{
20 JsonArray{"perfectlygenericitem"},
21 JsonArray{"perfectlygenericitem", 1},
22 JsonArray{"perfectlygenericitem", 1, JsonObject()},
23 JsonArray{"perfectlygenericitem", 1, JsonObject{{"testParameter", "testValue"}}}
24 };
25
26 for (auto arrayFormat : arrayFormats)
27 testItemDescriptor = ItemDescriptor(arrayFormat);
28
29 List<JsonObject> objectFormats = List<JsonObject>{
30 JsonObject{{"name", "perfectlygenericitem"}},
31 JsonObject{{"item", "perfectlygenericitem"}},
32 JsonObject{{"name", "perfectlygenericitem"}, {"count", 1}},
33 JsonObject{{"name", "perfectlygenericitem"}, {"count", 1}, {"parameters", JsonObject()}},
34 JsonObject{{"name", "perfectlygenericitem"}, {"count", 1}, {"parameters", JsonObject{{"testParameter", "testValue"}}}}
35 };
36
37 for (auto objectFormat : objectFormats)
38 testItemDescriptor = ItemDescriptor(objectFormat);
39
40 testItemDescriptor = ItemDescriptor("perfectlygenericitem", 1);
41 testItemDescriptor = ItemDescriptor("perfectlygenericitem", 1, JsonObject{{"testParameter", "testValue"}});
42}
43
44TEST(ItemTest, ItemComparison) {
45 auto itemDatabase = Root::singleton().itemDatabase();

Callers

nothing calls this directly

Calls 7

ItemDescriptorClass · 0.85
JsonClass · 0.85
singletonClass · 0.85
itemDatabaseMethod · 0.80
itemMethod · 0.45
matchesMethod · 0.45
allItemsMethod · 0.45

Tested by

no test coverage detected