Przeglądaj źródła

DSDE unit tests: add ta at start

Eric Ramat 5 lat temu
rodzic
commit
90ccb416b0
2 zmienionych plików z 6 dodań i 16 usunięć
  1. 4 5
      src/tests/dsde/models.hpp
  2. 2 11
      src/tests/dsde/tests.cpp

+ 4 - 5
src/tests/dsde/models.hpp

@@ -77,7 +77,7 @@ namespace artis {
                     common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    if (_phase == SEND) {
+                    if (_phase == SEND or _phase == INIT) {
                         _phase = WAIT;
                     }
                 }
@@ -127,7 +127,7 @@ namespace artis {
 
                 }
 
-                typename common::DoubleTime::type
+                void
                 start(typename common::DoubleTime::type t) override
                 {
 
@@ -144,8 +144,7 @@ namespace artis {
                     common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    _phase = WAIT;
-                    return 0;
+                    _phase = INIT;
                 }
 
                 typename common::DoubleTime::type
@@ -198,7 +197,7 @@ namespace artis {
 
             private:
                 enum Phase {
-                    WAIT, SEND
+                    INIT, WAIT, SEND
                 };
 
                 Phase _phase;

+ 2 - 11
src/tests/dsde/tests.cpp

@@ -49,15 +49,6 @@ TEST_CASE("dsde/flat", "run")
     artis::common::Trace<DoubleTime>::trace().clear();
     rc.run(context);
 
-//    std::cout << artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-//            "root").to_string() << std::endl;
-//    std::cout << artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-//            "beep2").to_string() << std::endl;
-//    std::cout << artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-//            "beep3").to_string() << std::endl;
-//    std::cout << artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-//            "executive").to_string() << std::endl;
-
     REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
             "beep").filter_function_type(artis::common::FunctionType::START).filter_time(0).size()
             == 1);
@@ -74,7 +65,7 @@ TEST_CASE("dsde/flat", "run")
             == 1);
     REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
             "beep2").filter_function_type(artis::common::FunctionType::TA).filter_time(1).size()
-            == 1);
+            == 2);
 
     REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
             "beep2").filter_function_type(artis::common::FunctionType::DELTA_INT).filter_time(
@@ -108,7 +99,7 @@ TEST_CASE("dsde/flat", "run")
             == 1);
     REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
             "beep3").filter_function_type(artis::common::FunctionType::TA).filter_time(3).size()
-            == 1);
+            == 2);
     REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
             "beep3").filter_function_type(artis::common::FunctionType::LAMBDA).filter_time(3).size()
             == 1);