MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / TEST

Function TEST

Engine/source/console/test/consoleTest.cpp:11–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9#include "console/stringStack.h"
10
11TEST(Con, executef)
12{
13 char buffer[128];
14 Con::evaluate("if (isObject(TestConExec)) {\r\nTestConExec.delete();\r\n}\r\nfunction testExecutef(%a,%b,%c,%d,%e,%f,%g,%h,%i,%j,%k){return %a SPC %b SPC %c SPC %d SPC %e SPC %f SPC %g SPC %h SPC %i SPC %j SPC %k;}\r\nfunction TestConExec::testThisFunction(%this,%a,%b,%c,%d,%e,%f,%g,%h,%i,%j){ return %a SPC %b SPC %c SPC %d SPC %e SPC %f SPC %g SPC %h SPC %i SPC %j;}\r\nnew ScriptObject(TestConExec);\r\n", false, "test");
15
16 SimObject *testObject = NULL;
17 Sim::findObject("TestConExec", testObject);
18
19 EXPECT_TRUE(testObject != NULL)
20 << "TestConExec object should exist";
21
22 // Check basic calls with SimObject. We'll do this for every single possible call just to make sure.
23 const char *returnValue = NULL;
24
25 returnValue = Con::executef(testObject, "testThisFunction");
26 EXPECT_TRUE(dStricmp(returnValue, " ") == 0) <<
27 "All values should be printed in the correct order";
28
29 returnValue = Con::executef(testObject, "testThisFunction", "a");
30 EXPECT_TRUE(dStricmp(returnValue, "a ") == 0) <<
31 "All values should be printed in the correct order";
32
33 returnValue = Con::executef(testObject, "testThisFunction", "a", "b");
34 EXPECT_TRUE(dStricmp(returnValue, "a b ") == 0) <<
35 "All values should be printed in the correct order";
36
37 returnValue = Con::executef(testObject, "testThisFunction", "a", "b", "c");
38 EXPECT_TRUE(dStricmp(returnValue, "a b c ") == 0) <<
39 "All values should be printed in the correct order";
40
41 returnValue = Con::executef(testObject, "testThisFunction", "a", "b", "c", "d");
42 EXPECT_TRUE(dStricmp(returnValue, "a b c d ") == 0) <<
43 "All values should be printed in the correct order";
44
45 returnValue = Con::executef(testObject, "testThisFunction", "a", "b", "c", "d", "e");
46 EXPECT_TRUE(dStricmp(returnValue, "a b c d e ") == 0) <<
47 "All values should be printed in the correct order";
48
49 returnValue = Con::executef(testObject, "testThisFunction", "a", "b", "c", "d", "e", "f");
50 EXPECT_TRUE(dStricmp(returnValue, "a b c d e f ") == 0) <<
51 "All values should be printed in the correct order";
52
53 returnValue = Con::executef(testObject, "testThisFunction", "a", "b", "c", "d", "e", "f", "g");
54 EXPECT_TRUE(dStricmp(returnValue, "a b c d e f g ") == 0) <<
55 "All values should be printed in the correct order";
56
57 returnValue = Con::executef(testObject, "testThisFunction", "a", "b", "c", "d", "e", "f", "g", "h");
58 EXPECT_TRUE(dStricmp(returnValue, "a b c d e f g h ") == 0) <<
59 "All values should be printed in the correct order";
60
61 returnValue = Con::executef(testObject, "testThisFunction", "a", "b", "c", "d", "e", "f", "g", "h", "i");
62 EXPECT_TRUE(dStricmp(returnValue, "a b c d e f g h i ") == 0) <<
63 "All values should be printed in the correct order";
64
65 // Now test without the object
66
67 returnValue = Con::executef("testExecutef");
68 EXPECT_TRUE(dStricmp(returnValue, " ") == 0) <<

Callers

nothing calls this directly

Calls 11

evaluateFunction · 0.85
executefFunction · 0.85
dStricmpFunction · 0.85
dSprintfFunction · 0.85
getFloatArgFunction · 0.85
executeFunction · 0.85
findObjectFunction · 0.50
getIdMethod · 0.45
pushFrameMethod · 0.45
initMethod · 0.45
popFrameMethod · 0.45

Tested by

no test coverage detected