ejson/test/testNumber.hpp

30 lines
786 B
C++
Raw Normal View History

2015-01-12 21:12:44 +01:00
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license MPL v2.0 (see license file)
2015-01-12 21:12:44 +01:00
*/
#pragma once
2015-01-12 21:12:44 +01:00
2016-09-30 22:28:36 +02:00
#include "testCommon.hpp"
2015-01-12 21:12:44 +01:00
#include <gtest/gtest.h>
2017-08-28 00:03:43 +02:00
static etk::String refOutputNumber("{\n\t\"tmpElement\": 956256\n}\n");
2015-01-12 21:12:44 +01:00
TEST(TestNumber, testBase) {
localTest(refOutputNumber, "{ tmpElement:956256 }\n", -1);
}
TEST(TestNumber, testTabbed) {
localTest(refOutputNumber, "{ \t\ntmpElement:956256 \t\n }\n", -1);
}
TEST(TestNumber, testNone) {
localTest(refOutputNumber, "tmpElement:956256\n", -1);
}
TEST(TestNumber, testNegative) {
localTest("{\n\t\"tmpElement\": -956256\n}\n", "{tmpElement:-956256}\n", -1);
}
TEST(TestNumber, testFloat) {
localTest("{\n\t\"tmpElement\": -956.256000\n}\n", "{tmpElement : -956.256}\n", -1);
}