FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
daScript/examples/test/main.cpp at master · alohaeee/daScript · GitHub
alohaeee
/
daScript
Public
forked from
GaijinEntertainment/daScript
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
daScript
/
examples
/
test
/
main.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
563 lines (540 loc) · 20.3 KB
Breadcrumbs
daScript
/
examples
/
test
/
main.cpp
Copy path
File metadata and controls
563 lines (540 loc) · 20.3 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
#
include
"
daScript/daScript.h
"
#
include
"
daScript/ast/ast_serializer.h
"
#
include
"
daScript/simulate/fs_file_info.h
"
#
include
"
daScript/misc/performance_time.h
"
#
include
"
daScript/misc/fpe.h
"
#
include
"
daScript/misc/sysos.h
"
#
ifdef
_MSC_VER
#
include
<
io.h
>
#
else
#
include
<
dirent.h
>
#
endif
#
if
DAS_SMART_PTR_TRACKER
#
include
<
inttypes.h
>
#
endif
using
namespace
das
;
bool
g_reportCompilationFailErrors =
false
;
bool
g_collectSharedModules =
true
;
bool
g_failOnSmartPtrLeaks =
true
;
TextPrinter tout;
template
<
typename
F>
bool
with_program_serialized
( F callback, ProgramPtr program ) {
//
serialize
AstSerializer ser;
program->
serialize
(ser);
program.
reset
();
//
deserialize
AstSerializer
deser
( ForReading{},
move
(ser.
buffer
) );
auto
new_program = make_smart<Program>();
new_program->
serialize
(deser);
program = new_program;
//
run it
return
callback
(program);
}
StandaloneContextNode * StandaloneContextNode::head =
nullptr
;
bool
run_all_standalone_context_tests
() {
vector<Context *> contexts;
while
(
auto
h = StandaloneContextNode::head ) {
StandaloneContextNode::head = h->
tail
;
contexts.
push_back
(h->
regFn
());
}
bool
res =
true
;
for
(
auto
context : contexts ) {
auto
fn_tests = context->
findFunctions
(
"
test
"
);
DAS_ASSERTF
(!fn_tests.
empty
(),
"
expected to see test inside a testing context
"
);
for
(
auto
fn_test: fn_tests ) {
bool
result = cast<
bool
>::
to
(context->
eval
(fn_test,
nullptr
));
if
(
auto
ex = context->
getException
() ) {
tout <<
"
exception:
"
<< ex <<
"
\n
"
;
res =
false
;
}
if
( !result ) {
tout <<
"
failed
\n
"
;
res =
false
;
}
}
}
return
res;
}
bool
compilation_fail_test
(
const
string & fn,
bool
,
bool
) {
uint64_t
timeStamp =
ref_time_ticks
();
tout << fn <<
"
"
;
auto
fAccess
= make_smart<FsFileAccess>();
ModuleGroup dummyLibGroup;
if
(
auto
program =
compileDaScript
(fn,
fAccess
, tout, dummyLibGroup) ) {
if
( program->
failed
() ) {
//
we allow circular module dependency to fly through
if
( program->
errors
.
size
()==
1
) {
if
( program->
errors
[
0
].
cerr
==CompilationError::module_not_found ) {
if
( fn.
find
(
"
circular_module_dependency
"
)!=string::npos ) {
tout <<
"
ok
\n
"
;
return
true
;
}
}
}
//
regular error processing
bool
failed =
false
;
auto
errors = program->
expectErrors
;
for
(
auto
err : program->
errors
) {
int
count = -- errors[err.
cerr
];
if
( g_reportCompilationFailErrors || count<
0
) {
tout <<
reportError
(err.
at
, err.
what
, err.
extra
, err.
fixme
, err.
cerr
);
}
if
( count <
0
) {
failed =
true
;
}
}
bool
any_errors =
false
;
for
(
auto
err : errors ) {
if
( err.
second
>
0
) {
any_errors =
true
;
break
;
}
}
if
( any_errors || failed ) {
tout <<
"
failed
"
;
if
( any_errors ) {
tout <<
"
, expecting errors
"
;
for
(
auto
terr : errors ) {
if
(terr.
second
>
0
) {
tout <<
"
"
<<
int
(terr.
first
) <<
"
:
"
<< terr.
second
;
}
}
}
tout <<
"
\n
"
;
return
false
;
}
int
usec =
get_time_usec
(timeStamp);
tout <<
"
ok
"
<< ((usec/
1000
)/
1000.0
) <<
"
\n
"
;
return
true
;
}
else
{
tout <<
"
failed, compiled without errors
\n
"
;
return
false
;
}
}
else
{
tout <<
"
failed, not expected to compile
\n
"
;
return
false
;
}
}
bool
unit_test
(
const
string & fn,
bool
useAot,
bool
useSer ) {
uint64_t
timeStamp =
ref_time_ticks
();
tout << fn <<
"
"
;
auto
fAccess
= make_smart<FsFileAccess>();
ModuleGroup dummyLibGroup;
CodeOfPolicies policies;
policies.
aot
= useAot;
policies.
fail_on_no_aot
=
true
;
//
policies.intern_strings = true;
//
policies.intern_const_strings = true;
//
policies.no_unsafe = true;
if
(
auto
program =
compileDaScript
(fn,
fAccess
, tout, dummyLibGroup, policies) ) {
if
( program->
failed
() ) {
tout <<
"
failed to compile
\n
"
;
for
(
auto
& err : program->
errors
) {
tout <<
reportError
(err.
at
, err.
what
, err.
extra
, err.
fixme
, err.
cerr
);
}
return
false
;
}
else
{
auto
F = [ &dummyLibGroup, timeStamp, useAot ] ( ProgramPtr program ) {
if
(program->
unsafe
) tout <<
"
[unsafe]
"
;
Context
ctx
(program->
getContextStackSize
());
if
( !program->
simulate
(ctx, tout) ) {
tout <<
"
failed to simulate
\n
"
;
for
(
auto
& err : program->
errors
) {
tout <<
reportError
(err.
at
, err.
what
, err.
extra
, err.
fixme
, err.
cerr
);
}
return
false
;
}
if
(
auto
fnTest = ctx.
findFunction
(
"
test
"
) ) {
if
( !verifyCall<
bool
>(fnTest->
debugInfo
, dummyLibGroup) ) {
tout <<
"
function 'test', call arguments do not match
\n
"
;
return
false
;
}
ctx.
restart
();
bool
result = cast<
bool
>::
to
(ctx.
eval
(fnTest,
nullptr
));
if
(
auto
ex = ctx.
getException
() ) {
tout <<
"
exception:
"
<< ex <<
"
\n
"
;
return
false
;
}
if
( !result ) {
tout <<
"
failed
\n
"
;
return
false
;
}
int
usec =
get_time_usec
(timeStamp);
tout << (useAot ?
"
ok AOT
"
:
"
ok
"
) << ((usec/
1000
)/
1000.0
) <<
"
\n
"
;
return
true
;
}
else
{
tout <<
"
function 'test' not found
\n
"
;
return
false
;
}
};
if
( useSer ) {
return
with_program_serialized
(F, program);
}
else
{
return
F
(program);
}
}
}
else
{
return
false
;
}
}
bool
exception_test
(
const
string & fn,
bool
useAot,
bool
) {
tout << fn <<
"
"
;
auto
fAccess
= make_smart<FsFileAccess>();
ModuleGroup dummyLibGroup;
CodeOfPolicies policies;
policies.
aot
= useAot;
if
(
auto
program =
compileDaScript
(fn,
fAccess
, tout, dummyLibGroup, policies) ) {
if
( program->
failed
() ) {
tout <<
"
failed to compile
\n
"
;
for
(
auto
& err : program->
errors
) {
tout <<
reportError
(err.
at
, err.
what
, err.
extra
, err.
fixme
, err.
cerr
);
}
return
false
;
}
else
{
Context
ctx
(program->
getContextStackSize
());
if
( !program->
simulate
(ctx, tout) ) {
tout <<
"
failed to simulate
\n
"
;
for
(
auto
& err : program->
errors
) {
tout <<
reportError
(err.
at
, err.
what
, err.
extra
, err.
fixme
, err.
cerr
);
}
return
false
;
}
if
(
auto
fnTest = ctx.
findFunction
(
"
test
"
) ) {
if
( !verifyCall<
bool
>(fnTest->
debugInfo
, dummyLibGroup) ) {
tout <<
"
function 'test', call arguments do not match
\n
"
;
return
false
;
}
ctx.
restart
();
ctx.
evalWithCatch
(fnTest,
nullptr
);
if
(
auto
ex = ctx.
getException
() ) {
tout <<
"
with exception
"
<< ex <<
"
,
"
<< (useAot ?
"
ok AOT
\n
"
:
"
ok
\n
"
);
return
true
;
}
tout <<
"
failed, finished without exception
\n
"
;
return
false
;
}
else
{
tout <<
"
function 'test' not found
\n
"
;
return
false
;
}
}
}
else
{
return
false
;
}
}
bool
performance_test
(
const
string & fn,
bool
useAot ) {
//
tout << fn << "\n";
auto
fAccess
= make_smart<FsFileAccess>();
ModuleGroup dummyLibGroup;
CodeOfPolicies policies;
policies.
aot
= useAot;
policies.
fail_on_no_aot
=
true
;
//
policies.intern_strings = true;
//
policies.intern_const_strings = true;
//
policies.no_unsafe = true;
if
(
auto
program =
compileDaScript
(fn,
fAccess
, tout, dummyLibGroup, policies) ) {
if
( program->
failed
() ) {
tout << fn <<
"
failed to compile
\n
"
;
for
(
auto
& err : program->
errors
) {
tout <<
reportError
(err.
at
, err.
what
, err.
extra
, err.
fixme
, err.
cerr
);
}
return
false
;
}
else
{
Context
ctx
(program->
getContextStackSize
());
if
( !program->
simulate
(ctx, tout) ) {
tout << fn <<
"
failed to simulate
\n
"
;
for
(
auto
& err : program->
errors
) {
tout <<
reportError
(err.
at
, err.
what
, err.
extra
, err.
fixme
, err.
cerr
);
}
return
false
;
}
return
true
;
}
}
else
{
return
false
;
}
}
bool
run_tests
(
const
string & path,
bool
(*test_fn)(
const
string &,
bool
useAot,
bool
useSer), bool useAot, bool useSer = false ) {
#
ifdef
_MSC_VER
bool
ok =
true
;
_finddata_t
c_file;
intptr_t
hFile;
string findPath = path +
"
/*.das
"
;
if
((hFile =
_findfirst
(findPath.
c_str
(), &c_file)) != -
1L
) {
do
{
const
char
* atDas =
strstr
(c_file.
name
,
"
.das
"
);
if
( atDas &&
strcmp
(atDas,
"
.das
"
)==
0
&& c_file.
name
[
0
]!=
'
_
'
) {
ok =
test_fn
(path +
"
/
"
+ c_file.
name
, useAot, useSer) && ok;
if
( g_collectSharedModules )
Module::CollectSharedModules
();
}
}
while
(
_findnext
(hFile, &c_file) ==
0
);
}
_findclose
(hFile);
return
ok;
#
else
bool
ok =
true
;
DIR
*dir;
struct
dirent
*ent;
if
((dir =
opendir
(path.
c_str
())) !=
NULL
) {
while
((ent =
readdir
(dir)) !=
NULL
) {
const
char
* atDas =
strstr
(ent->
d_name
,
"
.das
"
);
if
( atDas &&
strcmp
(atDas,
"
.das
"
)==
0
&& ent->
d_name
[
0
]!=
'
_
'
) {
ok =
test_fn
(path +
"
/
"
+ ent->
d_name
, useAot, useSer) && ok;
}
}
closedir
(dir);
}
return
ok;
#
endif
}
bool
run_unit_tests
(
const
string & path,
bool
check_aot =
false
,
bool
useSer =
false
) {
if
( check_aot ) {
return
run_tests
(path, unit_test,
false
, useSer ) &&
run_tests
(path, unit_test,
true
, useSer);
}
else
{
return
run_tests
(path, unit_test,
false
, useSer);
}
}
bool
isolated_unit_test
(
const
string & fn,
bool
useAot,
bool
useSer ) {
//
register modules
g_collectSharedModules =
false
;
NEED_MODULE
(Module_BuiltIn);
NEED_MODULE
(Module_Math);
NEED_MODULE
(Module_Raster);
NEED_MODULE
(Module_Strings);
NEED_MODULE
(Module_UnitTest);
NEED_MODULE
(Module_Rtti);
NEED_MODULE
(Module_Ast);
NEED_MODULE
(Module_Debugger);
NEED_MODULE
(Module_Network);
NEED_MODULE
(Module_UriParser);
NEED_MODULE
(Module_JobQue);
NEED_MODULE
(Module_FIO);
NEED_MODULE
(Module_DASBIND);
Module::Initialize
();
bool
result =
unit_test
(fn,useAot, useSer);
//
shutdown
Module::Shutdown
();
#
if
DAS_SMART_PTR_TRACKER
if
( g_smart_ptr_total ) {
if
( g_failOnSmartPtrLeaks ) {
result =
false
;
}
TextPrinter tp;
tp <<
"
smart pointers leaked:
"
<<
uint64_t
(g_smart_ptr_total) <<
"
\n
"
;
}
#
endif
return
result;
}
bool
run_isolated_unit_tests
(
const
string & path,
bool
check_aot =
false
,
bool
use_ser =
false
) {
if
( check_aot ) {
return
run_tests
(path, isolated_unit_test,
false
, use_ser) &&
run_tests
(path, unit_test,
true
, use_ser);
}
else
{
return
run_tests
(path, isolated_unit_test,
false
, use_ser);
}
}
bool
run_compilation_fail_tests
(
const
string & path ) {
return
run_tests
(path, compilation_fail_test,
false
,
false
);
}
bool
run_exception_tests
(
const
string & path ) {
return
run_tests
(path, exception_test,
false
,
false
) &&
run_tests
(path, exception_test,
true
,
false
);
}
bool
run_module_test
(
const
string & path,
const
string & main,
bool
usePak,
bool
useSer ) {
tout <<
"
testing MODULE at
"
<< path <<
"
"
;
auto
fAccess
= usePak ?
make_smart<FsFileAccess>( path +
"
/project.das_project
"
, make_smart<FsFileAccess>()) :
make_smart<FsFileAccess>();
ModuleGroup dummyLibGroup;
if
(
auto
program =
compileDaScript
(path +
"
/
"
+ main,
fAccess
, tout, dummyLibGroup) ) {
if
( program->
failed
() ) {
tout <<
"
failed to compile
\n
"
;
for
(
auto
& err : program->
errors
) {
tout <<
reportError
(err.
at
, err.
what
, err.
extra
, err.
fixme
, err.
cerr
);
}
return
false
;
}
else
{
auto
F = [&dummyLibGroup] ( ProgramPtr program ) {
Context
ctx
(program->
getContextStackSize
());
if
( !program->
simulate
(ctx, tout) ) {
tout <<
"
failed to simulate
\n
"
;
for
(
auto
& err : program->
errors
) {
tout <<
reportError
(err.
at
, err.
what
, err.
extra
, err.
fixme
, err.
cerr
);
}
return
false
;
}
if
(
auto
fnTest = ctx.
findFunction
(
"
test
"
) ) {
if
( !verifyCall<
bool
>(fnTest->
debugInfo
, dummyLibGroup) ) {
tout <<
"
function 'test', call arguments do not match
\n
"
;
return
false
;
}
ctx.
restart
();
bool
result = cast<
bool
>::
to
(ctx.
eval
(fnTest,
nullptr
));
if
(
auto
ex = ctx.
getException
() ) {
tout <<
"
exception:
"
<< ex <<
"
\n
"
;
return
false
;
}
if
( !result ) {
tout <<
"
failed
\n
"
;
return
false
;
}
tout <<
"
ok
\n
"
;
return
true
;
}
else
{
tout <<
"
function 'test' not found
\n
"
;
return
false
;
}
};
if
( useSer ) {
return
with_program_serialized
(F, program);
}
else
{
return
F
(program);
}
}
}
else
{
return
false
;
}
}
int
main
(
int
argc,
char
* argv[] ) {
if
( argc>
2
) {
tout <<
"
daScriptTest [pathToDasRoot]
\n
"
;
return
-
1
;
}
else
if
( argc==
2
) {
setDasRoot
(argv[
1
]);
}
setCommandLineArguments
(argc,argv);
//
ptr_ref_count::ref_count_track = 0x1242c;
//
das_track_string_breakpoint(189);
//
das_track_breakpoint(8);
//
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
//
_CrtSetBreakAlloc(6836533);
#
if
defined(_MSC_VER) || defined(__i386__)
_mm_setcsr
((
_mm_getcsr
()&~_MM_ROUND_MASK) | _MM_FLUSH_ZERO_MASK | _MM_ROUND_NEAREST |
0x40
);
//
0x40
FPE_ENABLE_ALL
;
#
endif
//
isolated uint tests
//
those are to test memory leaks on individual tests
#
if
0
run_isolated_unit_tests(getDasRoot() + "/examples/test/unit_tests", false);
return 0;
#
endif
//
register modules
NEED_MODULE
(Module_BuiltIn);
NEED_MODULE
(Module_Math);
NEED_MODULE
(Module_Raster);
NEED_MODULE
(Module_Strings);
NEED_MODULE
(Module_UnitTest);
NEED_MODULE
(Module_Rtti);
NEED_MODULE
(Module_Ast);
NEED_MODULE
(Module_Debugger);
NEED_MODULE
(Module_Network);
NEED_MODULE
(Module_UriParser);
NEED_MODULE
(Module_JobQue);
NEED_MODULE
(Module_FIO);
NEED_MODULE
(Module_DASBIND);
Module::Initialize
();
//
aot library
#
if
0
// Debug this one test
compilation_fail_test(getDasRoot() + "/examples/test/compilation_fail_tests/smart_ptr.das",true);
Module::Shutdown();
getchar();
return 0;
#
endif
#
if
0
// Debug this one test
// generators
// #define TEST_NAME "/dasgen/gen_bind.das"
// #define TEST_NAME "/doc/reflections/das2rst.das"
// examples
// #define TEST_NAME "/examples/test/dict_pg.das"
// #define TEST_NAME "/examples/test/hello_world.das"
// #define TEST_NAME "/examples/test/ast_print.das"
// #define TEST_NAME "/examples/test/base64.das"
// #define TEST_NAME "/examples/test/regex_lite.das"
// #define TEST_NAME "/examples/test/hello_world.das"
// #define TEST_NAME "/examples/test/json_example.das"
// #define TEST_NAME "/examples/test/ast_print.das"
// #define TEST_NAME "/examples/test/apply_example.das"
// #define TEST_NAME "/examples/test/unit_tests/hint_macros_example.das"
// #define TEST_NAME "/examples/test/unit_tests/aonce.das"
// #define TEST_NAME "/examples/test/unit_tests/check_defer.das"
#define TEST_NAME "/examples/test/unit_tests/return_reference.das"
unit_test(getDasRoot() + TEST_NAME,false);
unit_test(getDasRoot() + TEST_NAME,true);
// extra
// #define TEST_NAME "/examples/test/unit_tests/apply_macro_example.das"
// unit_test(getDasRoot() + TEST_NAME,false);
Module::Shutdown();
#if DAS_ENABLE_SMART_PTR_TRACKING
dumpTrackingLeaks();
#endif
getchar();
return 0;
#
endif
#
if
0
// Module test
run_module_test(getDasRoot() + "/examples/test/module", "main_inc.das", true);
Module::Shutdown();
getchar();
return 0;
#
endif
#
if
0
// COMPILER PERFORMANCE TESTS
{
uint64_t timeStamp = ref_time_ticks();
int tmin = INT_MAX;
for ( int passes=0; passes!=20; ++passes ) {
uint64_t timeStampM = ref_time_ticks();
if ( !run_tests(getDasRoot() + "/examples/test/unit_tests", performance_test, true) ) {
tout << "TESTS FAILED\n";
break;
}
int usecM = get_time_usec(timeStampM);
tmin = min(tmin, usecM);
}
// shutdown
int usec = get_time_usec(timeStamp);
tout << "tests took " << ((usec/1000)/1000.0) << ", min pass " << ((tmin / 1000) / 1000.0) << "\n";
Module::Shutdown();
}
return 0;
#
endif
#
if
0
// COMPILER PERFORMANCE SINGLE TEST
#define TEST_NAME "/examples/test/unit_tests/check_defer.das"
{
uint64_t timeStamp = ref_time_ticks();
for ( int passes=0; passes!=5; ++passes ) {
if ( !unit_test(getDasRoot() + TEST_NAME,false) ) {
tout << "TESTS FAILED\n";
break;
}
}
// shutdown
int usec = get_time_usec(timeStamp);
tout << "tests took " << ((usec/1000)/1000.0) << "\n";
Module::Shutdown();
getchar();
}
return 0;
#
endif
uint64_t
timeStamp =
ref_time_ticks
();
bool
ok =
true
;
//
ok = run_all_standalone_context_tests() && ok;
ok =
run_compilation_fail_tests
(
getDasRoot
() +
"
/examples/test/compilation_fail_tests
"
) && ok;
ok =
run_unit_tests
(
getDasRoot
() +
"
/examples/test/unit_tests
"
,
true
,
false
) && ok;
ok =
run_unit_tests
(
getDasRoot
() +
"
/examples/test/optimizations
"
,
false
,
false
) && ok;
ok =
run_exception_tests
(
getDasRoot
() +
"
/examples/test/runtime_errors
"
) && ok;
ok =
run_module_test
(
getDasRoot
() +
"
/examples/test/module
"
,
"
main.das
"
,
true
,
false
) && ok;
ok =
run_module_test
(
getDasRoot
() +
"
/examples/test/module
"
,
"
main_inc.das
"
,
true
,
false
) && ok;
ok =
run_module_test
(
getDasRoot
() +
"
/examples/test/module
"
,
"
main_default.das
"
,
false
,
false
) && ok;
ok =
run_module_test
(
getDasRoot
() +
"
/examples/test/module/alias
"
,
"
main.das
"
,
true
,
false
) && ok;
ok =
run_module_test
(
getDasRoot
() +
"
/examples/test/module/cdp
"
,
"
main.das
"
,
true
,
false
) && ok;
ok =
run_module_test
(
getDasRoot
() +
"
/examples/test/module/unsafe
"
,
"
main.das
"
,
true
,
false
) && ok;
int
usec =
get_time_usec
(timeStamp);
tout <<
"
TESTS
"
<< (ok ?
"
PASSED
"
:
"
FAILED!!!
"
) << ((usec/
1000
)/
1000.0
) <<
"
\n
"
;
//
shutdown
Module::Shutdown
();
#
if
DAS_SMART_PTR_TRACKER
if
( g_failOnSmartPtrLeaks ) {
ok = ok && (g_smart_ptr_total==
0
);
}
TextPrinter tp;
tp <<
"
smart pointers leaked:
"
<<
uint64_t
(g_smart_ptr_total) <<
"
\n
"
;
#
endif
return
ok ?
0
: -
1
;
}
Back
|
FazBrowse Home
|
New Git URL