Skip to content

Commit

Permalink
Compile Tests only for DIAG_DEVELOPER
Browse files Browse the repository at this point in the history
  • Loading branch information
simonvic committed Feb 28, 2022
1 parent a126aa0 commit a9b3800
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 55 deletions.
8 changes: 8 additions & 0 deletions scripts/3_Game/sUDE/util/testing/sTest.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifdef DIAG_DEVELOPER

class STest : Managed {

/**
Expand All @@ -24,6 +26,9 @@ class STest : Managed {
array<typename> tests = {
//TestUnit_STest,
TestUnit_SMath,
TestUnit_SFlagOperator,
TestUnit_SColor,
TestUnit_SFileHelper,
TestUnit_SConstraints,
TestUnit_SUserConfigOption,
TestUnit_SUserConfig,
Expand Down Expand Up @@ -151,3 +156,6 @@ class STest : Managed {

}



#endif
3 changes: 3 additions & 0 deletions scripts/3_Game/sUDE/util/testing/units/STestCase.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifdef DIAG_DEVELOPER

enum eSTestCaseStatus {
PASSED,
FAILED,
Expand Down Expand Up @@ -69,3 +71,4 @@ class STestCase : Managed {

}

#endif
6 changes: 5 additions & 1 deletion scripts/3_Game/sUDE/util/testing/units/STestUnit.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifdef DIAG_DEVELOPER

typedef Param2<Class, string> STestBeforeCallback;
typedef Param2<Class, string> STestBeforeClassCallback;
typedef Param2<Class, string> STestAfterCallback;
Expand Down Expand Up @@ -294,4 +296,6 @@ class STestUnit : Managed {
m_currentTestCaseTested.setMessage(message);

}
}
}

#endif
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifdef DIAG_DEVELOPER

class TestUnit_SObservableArray : STestUnit {


Expand Down Expand Up @@ -147,4 +149,6 @@ class TestUnit_SObservableArray : STestUnit {
pass("2", ""+arguments.param1);
}

}
}

#endif
8 changes: 8 additions & 0 deletions scripts/3_Game/sUDE/util/testing/units/TestUnit_SColor.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifdef DIAG_DEVELOPER

class TestUnit_SColor : STestUnit {

}


#endif
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifdef DIAG_DEVELOPER

class TestUnit_SConstraints : STestUnit {

override void init() {
Expand Down Expand Up @@ -151,4 +153,6 @@ class TestUnit_SConstraints : STestUnit {
assertEqual(expected, constraint.constrained(toCostrain));
}

}
}

#endif
8 changes: 8 additions & 0 deletions scripts/3_Game/sUDE/util/testing/units/TestUnit_SFileHelper.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifdef DIAG_DEVELOPER

class TestUnit_SFileHelper : STestUnit {

}


#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifdef DIAG_DEVELOPER

class TestUnit_SFlagOperator : STestUnit {

}


#endif
6 changes: 5 additions & 1 deletion scripts/3_Game/sUDE/util/testing/units/TestUnit_SMath.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifdef DIAG_DEVELOPER

class TestUnit_SMath : STestUnit {

override void init() {
Expand Down Expand Up @@ -130,4 +132,6 @@ class TestUnit_SMath : STestUnit {
void shouldSkip() {
// do nothing
}
}
}

#endif
7 changes: 6 additions & 1 deletion scripts/3_Game/sUDE/util/testing/units/TestUnit_STest.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifdef DIAG_DEVELOPER

//lol :)
class TestUnit_STest : STestUnit {

Expand Down Expand Up @@ -84,4 +86,7 @@ class TestUnit_STest : STestUnit {
void testAssertNotNull() {
assertNotNull(new SColor());
}
}
}


#endif
55 changes: 6 additions & 49 deletions scripts/3_Game/sUDE/util/testing/units/TestUnit_SUserConfig.c
Original file line number Diff line number Diff line change
@@ -1,52 +1,9 @@
#ifdef DIAG_DEVELOPER

class TestUnit_SUserConfig : STestUnit {

override void init() {

}

/*
private void testConstraints() {
auto f_constraint = new SConstraintPrimitiveMinMaxNumeric<float>(0, 1);
assertEqual(false, f_constraint.isEnabled());
auto f_option = new SUserConfigOption<float>(0.69, f_constraint);
assertEqual(true, f_option.hasConstraint());
assertEqual(false, f_option.isConstrained());
f_option.removeConstraint();
assertEqual(false, f_option.hasConstraint());
assertEqual(false, f_option.isConstrained());
f_option.setConstraint(f_constraint);
assertEqual(true, f_option.hasConstraint());
assertEqual(false, f_option.isConstrained());
}
private void testOptionsValuesWithConstraints() {
auto f_constraint = new SConstraintPrimitiveMinMaxNumeric<float>(0, 1);
auto f_option = new SUserConfigOption<float>(0.69, f_constraint);
assertEqual(0.69, f_option.get());
}

f_option.set(2.0);
assertEqual(2.0, f_option.get());
f_option.enableConstraint();
assertEqual(1.0, f_option.get());
f_constraint.disable();
f_option.set(-2.0);
assertEqual(-2.0, f_option.get());
f_constraint.enable();
assertEqual(-2.0, f_option.get());
f_option.updateConstraint();
assertEqual(0.0, f_option.get());
}
*/

}


#endif
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifdef DIAG_DEVELOPER

class TestUnit_SUserConfigOption : STestUnit {

ref SUserConfigOption<float> option;
Expand Down Expand Up @@ -114,4 +116,7 @@ class TestUnit_SUserConfigOption : STestUnit {
assertEqual(1.0, option.get());
}

}
}


#endif

0 comments on commit a9b3800

Please sign in to comment.