diff --git a/CMakeLists.txt b/CMakeLists.txt index 660c7f2..d96eca2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ project(mrubypp LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -option(MRUBYPP_BUILD_TEST "Build Catch2 Test" ON) +option(MRUBYPP_BUILD_TEST "Build Catch2 Test" OFF) if (MSVC) add_compile_options("$<$:/utf-8>") diff --git a/README.md b/README.md new file mode 100644 index 0000000..9e8e853 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# mrubypp + +mruby c++ header only library + +## Installation +- install mruby +- add to cmake project, link `mrubypp` or copy *.h to you projects +- `cmake -DMRUBYPP_BUILD_TEST=ON .` build tests + +## Usage +``` + #include "mrubypp.h" + + mrubypp engine; + engine.load(R"( + def sort_and_get_first(a) + a.sort! + a[0] + end + )"); + + std::vector a{3, 1, 2}; + auto b = engine.call("sort_and_get_first", a); + assert(b == 1); +``` \ No newline at end of file diff --git a/test/test_engine.cpp b/test/test_engine.cpp index a9ca097..6d71bd0 100644 --- a/test/test_engine.cpp +++ b/test/test_engine.cpp @@ -24,14 +24,14 @@ TEST_CASE("none args call", "[engine]") { TEST_CASE("args call", "[engine]") { mrubypp engine; engine.load(R"( - def add(a) + def sort_and_get_first(a) a.sort! a[0] end )"); std::vector a{3, 1, 2}; - auto b = engine.call("add", a); + auto b = engine.call("sort_and_get_first", a); REQUIRE(b == 1); }