ChaiScript/unittests/c_linkage_test.cpp
Bernd Amend cff6a0aced change .clang-format and reformat code with clang-format 11
I initially tried to use the existing .clang-format file,
but it does not match the code style (at least with clang-format 11)
and the formatting is not consistent across files.
Therefore, I decided to rewrite the .clang-format with some personal
preferences.

Used command
  find . -iname "*.hpp" -o -iname "*.cpp" | xargs clang-format -i -style=file
2021-05-24 10:44:15 +02:00

17 lines
456 B
C++

#include "../static_libs/chaiscript_parser.hpp"
#include "../static_libs/chaiscript_stdlib.hpp"
#include <chaiscript/chaiscript_basic.hpp>
extern "C" {
int do_something(int i) {
return i % 2;
}
}
int main() {
chaiscript::ChaiScript_Basic chai(create_chaiscript_stdlib(), create_chaiscript_parser());
chai.add(chaiscript::fun(&do_something), "do_something");
return chai.eval<int>("do_something(101)") == 101 % 2 ? EXIT_SUCCESS : EXIT_FAILURE;
}