-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathstring_id.cpp
More file actions
29 lines (20 loc) · 856 Bytes
/
string_id.cpp
File metadata and controls
29 lines (20 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
//#include <sstream>
#include "catch.hpp"
#include <chaiscript/chaiscript.hpp>
#include <chaiscript/chaiscript_stdlib.hpp>
#include "../include/chaiscript/extras/string_id.hpp"
#include <iostream>
TEST_CASE( "string_id functions work", "[string_id]" ) {
auto stdlib = chaiscript::Std_Lib::library();
auto string_idlib = chaiscript::extras::string_id::bootstrap();
chaiscript::ChaiScript chai(stdlib);
chai.add(string_idlib);
foonathan::string_id::default_database database;
chai.add(chaiscript::var(std::ref(database)), "database");
chai.eval(R""(
var id = string_id("Test0815", database);
)"");
using namespace foonathan::string_id::literals;
CHECK(chai.eval<const foonathan::string_id::string_id &>("id") == "Test0815");
}