ejson/test/testBoolean.cpp

48 lines
1.4 KiB
C++
Raw Normal View History

2015-01-12 21:12:44 +01:00
/**
* @author Edouard DUPIN
2015-01-13 22:29:26 +01:00
* @copyright 2014, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
2015-01-12 21:12:44 +01:00
*/
2016-09-30 22:28:36 +02:00
#include "testCommon.hpp"
2017-09-07 23:38:26 +02:00
#include <etest/etest.hpp>
2015-01-12 21:12:44 +01:00
2017-08-28 00:03:43 +02:00
static etk::String refOutputBoolean1("{\n\t\"tmpElement\": true\n}\n");
2015-01-12 21:12:44 +01:00
TEST(TestBoolean, testBaseTrue) {
localTest(refOutputBoolean1, "{ tmpElement:true }\n", -1);
}
TEST(TestBoolean, testTabbedTrue) {
localTest(refOutputBoolean1, "{ \t\ntmpElement:true \t\n }\n", -1);
}
TEST(TestBoolean, testNoneTrue) {
localTest(refOutputBoolean1, "tmpElement:true\n", -1);
}
TEST(TestBoolean, testBaseTrue1) {
localTest(refOutputBoolean1, "{ tmpElement:TRUE }\n", 1);
}
TEST(TestBoolean, testBaseTrue2) {
localTest(refOutputBoolean1, "{ tmpElement:True }\n", 1);
}
2017-08-28 00:03:43 +02:00
static etk::String refOutputBoolean2("{\n\t\"tmpElement\": false\n}\n");
2015-01-12 21:12:44 +01:00
TEST(TestBoolean, testBaseFalse) {
localTest(refOutputBoolean2, "{ tmpElement:false }\n", -1);
}
TEST(TestBoolean, testTabbedFalse) {
localTest(refOutputBoolean2, "{ \t\ntmpElement:false \t\n }\n", -1);
}
TEST(TestBoolean, testNoneFalse) {
localTest(refOutputBoolean2, "tmpElement:false\n", -1);
}
TEST(TestBoolean, testBaseFalse1) {
localTest(refOutputBoolean2, "{ tmpElement:FALSE }\n", 1);
}
TEST(TestBoolean, testBaseFalse2) {
localTest(refOutputBoolean2, "{ tmpElement:False }\n", 1);
}
TEST(TestBoolean, multipleValue) {
localTest("{\n\t\"tmpElement\": false,\n\t\"tmpElement2\": true\n}\n", "{ tmpElement:false, tmpElement2:true }\n", -1);
}