Development Examples
Overview
This section provides a minimal module and a testing example.
1. Example Module
int add(int a, int b)
{
return a + b;
}
2. Example Test
#include <gtest/gtest.h>
class BaseExample : public ::testing::Test {
protected:
const double tol = 1e-3;
int level;
protected:
void SetUp() override {
// Initialization
...
api_start_modeller(0);
}
void TearDown() override {
api_stop_modeller();
// Clean up processes
...
}
};
TEST(BaseExample, AddTest)
{
EXPECT_EQ(add(1, 2), 3);
}
3. Example Structure
src/base/
tests/functional/base/
4. Build and Run
cmake -B build -DBUILD_BASE=ON
cmake --build build
./bin/GME_tests