You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
676 B
36 lines
676 B
10 years ago
|
//
|
||
|
// Created by Marek Kotewicz on 27/04/15.
|
||
|
//
|
||
|
|
||
|
#include <boost/test/unit_test.hpp>
|
||
|
#include <libjsengine/JSV8Engine.h>
|
||
|
|
||
|
using namespace std;
|
||
|
using namespace dev;
|
||
|
using namespace dev::eth;
|
||
|
|
||
|
BOOST_AUTO_TEST_SUITE(jsv8engine)
|
||
|
|
||
|
BOOST_AUTO_TEST_CASE(evalInteger)
|
||
|
{
|
||
|
JSV8Engine scope;
|
||
|
string result = scope.evaluate("1 + 1");
|
||
|
BOOST_CHECK_EQUAL(result, "2");
|
||
|
}
|
||
|
|
||
|
BOOST_AUTO_TEST_CASE(evalString)
|
||
|
{
|
||
|
JSV8Engine scope;
|
||
|
string result = scope.evaluate("'hello ' + 'world'");
|
||
|
BOOST_CHECK_EQUAL(result, "hello world");
|
||
|
}
|
||
|
|
||
|
BOOST_AUTO_TEST_CASE(evalEmpty)
|
||
|
{
|
||
|
JSV8Engine scope;
|
||
|
string result = scope.evaluate("");
|
||
|
BOOST_CHECK_EQUAL(result, "undefined");
|
||
|
}
|
||
|
|
||
|
BOOST_AUTO_TEST_SUITE_END()
|