]> git.stg.codes - stg.git/blobdiff - tests/test_tariff.cpp
Ticket 37. 'Allow equal' and 'Allow expensive' comments changed to
[stg.git] / tests / test_tariff.cpp
index 71b1e57b74e5db0c619ce251525b9d8992d35da7..261acd26fd7fcb1cb9580b654e1567e814cd6d0f 100644 (file)
@@ -362,9 +362,9 @@ namespace tut
         ensure_equals("Allow cheaper", tariff.TariffChangeIsAllowed(cheaper).empty(), true);
 
         td.tariffConf.fee = 100;
-        TARIFF_IMPL equals(td);
+        TARIFF_IMPL equal(td);
 
-        ensure_equals("Allow equal", tariff.TariffChangeIsAllowed(equals).empty(), true);
+        ensure_equals("Allow equal", tariff.TariffChangeIsAllowed(equal).empty(), true);
 
         td.tariffConf.fee = 150;
         TARIFF_IMPL expensive(td);
@@ -389,9 +389,63 @@ namespace tut
         ensure_equals("Allow cheaper", tariff.TariffChangeIsAllowed(cheaper).empty(), true);
 
         td.tariffConf.fee = 100;
-        TARIFF_IMPL equals(td);
+        TARIFF_IMPL equal(td);
 
-        ensure_equals("Allow equal", !tariff.TariffChangeIsAllowed(equals).empty(), true);
+        ensure_equals("Prohibit equal", !tariff.TariffChangeIsAllowed(equal).empty(), true);
+
+        td.tariffConf.fee = 150;
+        TARIFF_IMPL expensive(td);
+
+        ensure_equals("Prohibit expensive", !tariff.TariffChangeIsAllowed(expensive).empty(), true);
+    }
+
+    template<>
+    template<>
+    void testobject::test<9>()
+    {
+        set_test_name("Check changePolicy - TO_EXPENSIVE");
+
+        TARIFF_DATA td("test");
+        td.tariffConf.changePolicy = TARIFF::TO_EXPENSIVE;
+        td.tariffConf.fee = 100;
+        TARIFF_IMPL tariff(td);
+
+        td.tariffConf.fee = 50;
+        TARIFF_IMPL cheaper(td);
+
+        ensure_equals("Allow cheaper", !tariff.TariffChangeIsAllowed(cheaper).empty(), true);
+
+        td.tariffConf.fee = 100;
+        TARIFF_IMPL equal(td);
+
+        ensure_equals("Allow equal", !tariff.TariffChangeIsAllowed(equal).empty(), true);
+
+        td.tariffConf.fee = 150;
+        TARIFF_IMPL expensive(td);
+
+        ensure_equals("Allow expensive", tariff.TariffChangeIsAllowed(expensive).empty(), true);
+    }
+
+    template<>
+    template<>
+    void testobject::test<10>()
+    {
+        set_test_name("Check changePolicy - DENY");
+
+        TARIFF_DATA td("test");
+        td.tariffConf.changePolicy = TARIFF::DENY;
+        td.tariffConf.fee = 100;
+        TARIFF_IMPL tariff(td);
+
+        td.tariffConf.fee = 50;
+        TARIFF_IMPL cheaper(td);
+
+        ensure_equals("Allow cheaper", !tariff.TariffChangeIsAllowed(cheaper).empty(), true);
+
+        td.tariffConf.fee = 100;
+        TARIFF_IMPL equal(td);
+
+        ensure_equals("Allow equal", !tariff.TariffChangeIsAllowed(equal).empty(), true);
 
         td.tariffConf.fee = 150;
         TARIFF_IMPL expensive(td);