From 383a419d2d2f512665060a3ef9917ea34a30ad2e Mon Sep 17 00:00:00 2001 From: zekexiao Date: Sat, 18 Oct 2025 20:36:35 +0800 Subject: [PATCH] remove unused main --- main.cpp | 60 -------------------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 main.cpp diff --git a/main.cpp b/main.cpp deleted file mode 100644 index 5e822d6..0000000 --- a/main.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include - -#include - -#include "example/Point.h" -#include "mrubypp.h" -#include "mrubypp_bind_class.h" - -#ifdef _WIN32 -#include -#include -#endif -int main() { -#ifdef _WIN32 - SetConsoleOutputCP(CP_UTF8); -#endif - mrubypp engine; - engine.load(R"( -def add(a) - a.sort! - a[0] -end)"); - - std::vector a{3, 1, 2}; - static volatile int b = 0; - std::chrono::steady_clock::time_point start = - std::chrono::steady_clock::now(); - for (auto i = 0; i < 10000; ++i) { - b = engine.call("add", a); - assert(b == 1); - } - std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); - auto duration = - std::chrono::duration_cast(end - start) - .count(); - std::cout << "10000 ruby call duration: " << duration << "ms" << std::endl; - - engine.class_builder("Point") - .def_constructor() - .def_method("add", &Point::add) - .def_class_method("none", &Point::none) - .def_property("x", &Point::get_x, &Point::set_x); - - engine.load(R"( - def test_point() - p = Point.new(3, 4) - p.x = 10 - p.add(p) - p.x += Point::none() - return p - end - )"); - - // 调用test_point函数 - auto point_result = engine.call("test_point"); - std::cout << "returned point: [" << point_result.get_x() << ", " - << point_result.get_y() << "]" << std::endl; - - return 0; -}