add variant test

This commit is contained in:
Konstantin Käfer
2014-05-02 13:41:45 +02:00
parent 7010954229
commit 93e0c49faa
4 changed files with 45 additions and 4 deletions

View File

@@ -64,6 +64,22 @@
"../llmr.gyp:llmr-x86"
]
},
{
"target_name": "variant",
"product_name": "test_variant",
"type": "executable",
"libraries": [
"-lpthread",
],
"sources": [
"./main.cpp",
"./variant.cpp",
],
"dependencies": [
"../deps/gtest/gtest.gyp:gtest",
"../llmr.gyp:llmr-x86"
]
},
{
"target_name": "headless",
"product_name": "test_headless",
@@ -88,7 +104,8 @@
"target_name": "test",
"type": "none",
"dependencies": [
"rotation_range"
"rotation_range",
"variant",
],
}
]

18
test/variant.cpp Normal file
View File

@@ -0,0 +1,18 @@
#include <iostream>
#include "gtest/gtest.h"
#include <llmr/style/value.hpp>
#include <boost/lexical_cast.hpp>
using namespace llmr;
TEST(Variant, toString) {
EXPECT_EQ("lord", llmr::toString( (std::string)"lord" ));
EXPECT_EQ("36", llmr::toString( (uint64_t)36 ));
EXPECT_EQ("-239", llmr::toString( (int64_t)-239 ));
EXPECT_EQ("0", llmr::toString( (int64_t)0 ));
EXPECT_EQ("3.14159268", llmr::toString( (double)3.14159268 ));
EXPECT_EQ("3.1415926535897931", llmr::toString( (double)3.1415926535897931 ));
EXPECT_EQ("true", llmr::toString( true ));
EXPECT_EQ("false", llmr::toString( false ));
}