FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
daScript/modules/dasUnitTest/test_enum.cpp at master · WhyNot135/daScript · GitHub
WhyNot135
/
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
/
modules
/
dasUnitTest
/
test_enum.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
63 lines (49 loc) · 2.41 KB
Breadcrumbs
daScript
/
modules
/
dasUnitTest
/
test_enum.cpp
Copy path
File metadata and controls
63 lines (49 loc) · 2.41 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
#
include
"
daScript/misc/platform.h
"
#
include
"
unitTest.h
"
#
include
"
module_unitTest.h
"
using
namespace
das
;
DAS_BASE_BIND_ENUM
(SomeEnum, SomeEnum, zero, one, two)
DAS_BASE_BIND_ENUM
(Goo::GooEnum, GooEnum, regular, hazardous)
DAS_BASE_BIND_ENUM_98
(Goo::GooEnum98, GooEnum98, soft, hard)
Goo::GooEnum
efn_flip
( Goo::GooEnum goo ) {
return
(goo == Goo::GooEnum::regular) ? Goo::GooEnum::hazardous : Goo::GooEnum::regular;
}
SomeEnum
efn_takeOne_giveTwo
( SomeEnum one ) {
return
(one == SomeEnum::one) ? SomeEnum::two : SomeEnum::zero;
}
DAS_BASE_BIND_ENUM_98
(SomeEnum98, SomeEnum98, SomeEnum98_zero, SomeEnum98_one, SomeEnum98_two)
SomeEnum98
efn_takeOne_giveTwo_98
( SomeEnum98 one ) {
return
(one == SomeEnum98_one) ? SomeEnum98_two : SomeEnum98_zero;
}
SomeEnum98_DasProxy
efn_takeOne_giveTwo_98_DasProxy
( SomeEnum98_DasProxy two) {
return
(SomeEnum98_DasProxy)
efn_takeOne_giveTwo_98
( (SomeEnum98)two);
}
DAS_BASE_BIND_ENUM_98
(SomeEnum_16, SomeEnum_16, SomeEnum_16_zero, SomeEnum_16_one, SomeEnum_16_two)
bool
testBindEnumFunction
( Context * context, LineInfoArg * at ) {
if
( !context->
thisProgram
) {
context->
throw_error_at
(at,
"
missing options rtti
"
);
}
SimFunction * fn = context->
findFunction
(
"
testBindEnum
"
);
if
( !fn ) {
context->
throw_error_at
(at,
"
missing testBindEnum(arg:SomeEnum):void function
"
);
}
return
verifyCall<
void
,SomeEnum>(fn->
debugInfo
, context->
thisProgram
->
library
);
}
void
Module_UnitTest::addEnumTest
(ModuleLibrary &lib)
{
//
enum
addEnumeration
(
new
EnumerationGooEnum
());
addEnumeration
(
new
EnumerationSomeEnum
());
addExtern<
DAS_BIND_FUN
(efn_takeOne_giveTwo)>(*
this
, lib,
"
free_takeOne_giveTwo
"
, SideEffects::none,
"
efn_takeOne_giveTwo
"
);
addExtern<
DAS_BIND_FUN
(efn_takeOne_giveTwo)>(*
this
, lib,
"
efn_takeOne_giveTwo
"
, SideEffects::modifyExternal,
"
efn_takeOne_giveTwo
"
);
addExtern<
DAS_BIND_FUN
(efn_flip)>(*
this
, lib,
"
efn_flip
"
, SideEffects::modifyExternal,
"
efn_flip
"
);
//
enum98
addEnumeration
(
new
EnumerationSomeEnum98
());
addExtern<
DAS_BIND_FUN
(efn_takeOne_giveTwo_98_DasProxy)>(*
this
, lib,
"
efn_takeOne_giveTwo_98
"
,
SideEffects::modifyExternal,
"
efn_takeOne_giveTwo_98
"
);
//
enum16
addEnumeration
(
new
EnumerationSomeEnum_16
());
//
testing verifyCall
addExtern<
DAS_BIND_FUN
(testBindEnumFunction)>(*
this
, lib,
"
testBindEnumFunction
"
,
SideEffects::worstDefault,
"
testBindEnumFunction
"
);
};
Back
|
FazBrowse Home
|
New Git URL