aboutsummaryrefslogtreecommitdiffstats
path: root/lib/LuaBridge/Tests/JuceLibraryCode/BinaryData.cpp
blob: ffc5f776e0d2c7f969629ae7be7c009cd33c4978 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/* ==================================== JUCER_BINARY_RESOURCE ====================================

   This is an auto-generated file, created by The Introjucer 3.0.0
   Do not edit anything in this file!

*/

namespace BinaryData
{

//================== Tests.lua ==================
static const unsigned char temp_b6c6a671[] =
"-- test lua script to be run with the luabridge test program\r\n"
"\r\n"
"print(\"Running LuaBridge tests:\");\r\n"
"\r\n"
"-- enum from C++\r\n"
"FN_CTOR = 0\r\n"
"FN_DTOR = 1\r\n"
"FN_STATIC = 2\r\n"
"FN_VIRTUAL = 3\r\n"
"FN_PROPGET = 4\r\n"
"FN_PROPSET = 5\r\n"
"FN_STATIC_PROPGET = 6\r\n"
"FN_STATIC_PROPSET = 7\r\n"
"FN_OPERATOR = 8\r\n"
"NUM_FN_TYPES = 9\r\n"
"\r\n"
"-- function to print contents of a table\r\n"
"function printtable (t)\r\n"
"  for k, v in pairs(t) do\r\n"
"    if (type(v) == \"table\") then\r\n"
"      print(k .. \" =>\", \"(table)\");\r\n"
"    elseif (type(v) == \"function\") then\r\n"
"      print(k .. \" =>\", \"(function)\");\r\n"
"    elseif (type(v) == \"userdata\") then\r\n"
"      print(k .. \" =>\", \"(userdata)\");\r\n"
"    else\r\n"
"      print(k .. \" =>\", v);\r\n"
"    end\r\n"
"  end\r\n"
"end\r\n"
"\r\n"
"function assert (expr)\r\n"
"  if (not expr) then error(\"assert failed\", 2) end\r\n"
"end\r\n"
"\r\n"
"-- test functions registered from C++\r\n"
"\r\n"
"assert(testSucceeded());\r\n"
"assert(testRetInt() == 47);\r\n"
"assert(testRetFloat() == 47.0);\r\n"
"assert(testRetConstCharPtr() == \"Hello, world\");\r\n"
"assert(testRetStdString() == \"Hello, world\");\r\n"
"\r\n"
"testParamInt(47);                       assert(testSucceeded());\r\n"
"testParamBool(true);                    assert(testSucceeded());\r\n"
"testParamFloat(47.0);                   assert(testSucceeded());\r\n"
"testParamConstCharPtr(\"Hello, world\");  assert(testSucceeded());\r\n"
"testParamStdString(\"Hello, world\");     assert(testSucceeded());\r\n"
"testParamStdStringRef(\"Hello, world\");  assert(testSucceeded());\r\n"
"\r\n"
"-- test static methods of classes registered from C++\r\n"
"\r\n"
"A.testStatic();             assert(testAFnCalled(FN_STATIC));\r\n"
"B.testStatic();             assert(testAFnCalled(FN_STATIC));\r\n"
"B.testStatic2();            assert(testBFnCalled(FN_STATIC));\r\n"
"\r\n"
"-- test static properties of classes registered from C++\r\n"
"\r\n"
"assert(A.testStaticProp == 47);\r\n"
"assert(A.testStaticProp2 == 47);assert(testAFnCalled(FN_STATIC_PROPGET));\r\n"
"A.testStaticProp = 48;          assert(A.testStaticProp == 48);\r\n"
"A.testStaticProp2 = 49;         assert(testAFnCalled(FN_STATIC_PROPSET) and A.testStaticProp2 == 49);\r\n"
"\r\n"
"-- test classes registered from C++\r\n"
"\r\n"
"object1 = A(\"object1\");          assert(testAFnCalled(FN_CTOR));\r\n"
"object1:testVirtual();           assert(testAFnCalled(FN_VIRTUAL));\r\n"
"\r\n"
"object2 = B(\"object2\");         assert(testAFnCalled(FN_CTOR) and testBFnCalled(FN_CTOR));\r\n"
"object2:testVirtual();          assert(testBFnCalled(FN_VIRTUAL) and not testAFnCalled(FN_VIRTUAL));\r\n"
"\r\n"
"-- test functions taking and returning objects\r\n"
"\r\n"
"testParamAPtr(object1);          assert(object1:testSucceeded());\r\n"
"testParamAPtrConst(object1);     assert(object1:testSucceeded());\r\n"
"testParamConstAPtr(object1);     assert(object1:testSucceeded());\r\n"
"testParamSharedPtrA(object1);    assert(object1:testSucceeded());\r\n"
"\r\n"
"testParamAPtr(object2);          assert(object2:testSucceeded());\r\n"
"testParamAPtrConst(object2);     assert(object2:testSucceeded());\r\n"
"testParamConstAPtr(object2);     assert(object2:testSucceeded());\r\n"
"testParamSharedPtrA(object2);    assert(object2:testSucceeded());\r\n"
"\r\n"
"result = testRetSharedPtrA();    assert(result:getName() == \"from C\");\r\n"
"\r\n"
"-- test constness\r\n"
"\r\n"
"constA = testRetSharedPtrConstA();    assert(constA:getName() == \"const A\");\r\n"
"assert(constA.testVirtual == nil);\r\n"
"testParamConstAPtr(constA);        assert(constA:testSucceeded());\r\n"
"assert(pcall(testParamAPtr, constA) == false, \"attempt to call nil value\");\r\n"
"\r\n"
"-- test properties\r\n"
"\r\n"
"assert(object1.testProp == 47);\r\n"
"assert(object1.testProp2 == 47);    assert(testAFnCalled(FN_PROPGET));\r\n"
"assert(object2.testProp == 47);\r\n"
"assert(object2.testProp2 == 47);    assert(testAFnCalled(FN_PROPGET));\r\n"
"\r\n"
"object1.testProp = 48;          assert(object1.testProp == 48);\r\n"
"object1.testProp2 = 49;          assert(testAFnCalled(FN_PROPSET) and object1.testProp2 == 49);\r\n"
"\r\n"
"-- test operator overload\r\n"
"object1a = object1 + object1;      assert(testAFnCalled(FN_OPERATOR));\r\n"
"assert(object1a:getName() == \"object1 + object1\");\r\n"
"\r\n"
"print(\"All tests succeeded.\");\r\n";

const char* Tests_lua = (const char*) temp_b6c6a671;


const char* getNamedResource (const char*, int&) throw();
const char* getNamedResource (const char* resourceNameUTF8, int& numBytes) throw()
{
    unsigned hash = 0;
    if (resourceNameUTF8 != 0)
        while (*resourceNameUTF8 != 0)
            hash = 31 * hash + *resourceNameUTF8++;

    switch (hash)
    {
        case 0x322b48ba:
        case 0xeec98b6c:  numBytes = 3877; return Tests_lua;
        default: break;
    }

    numBytes = 0;
    return 0;
}

}