From 7717b50da6f4e40cfe05ca066eed938506633f1a Mon Sep 17 00:00:00 2001 From: Andru Liu <90433630+WallabyLester@users.noreply.github.com> Date: Tue, 8 Oct 2024 21:52:45 -0700 Subject: [PATCH] Adding rbf model tests. First test. --- CPP_Implementation/rbf_model_test.cpp | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 CPP_Implementation/rbf_model_test.cpp diff --git a/CPP_Implementation/rbf_model_test.cpp b/CPP_Implementation/rbf_model_test.cpp new file mode 100644 index 0000000..b21edca --- /dev/null +++ b/CPP_Implementation/rbf_model_test.cpp @@ -0,0 +1,34 @@ +#include +#include "rbf_model.h" + +// Test fixture for RBFModel +class RBFModelTest : public ::testing::Test { +protected: + void SetUp() override { + // Set up an RBF model with 3 centers, 3D input, and random centers + n_centers = 3; + input_dim = 3; + rbf = new RBFModel(n_centers, input_dim); + } + + void TearDown() override { + delete rbf; + } + + RBFModel* rbf; + int n_centers; + int input_dim; +}; + +// Test constructor and initial weight values +TEST_F(RBFModelTest, Constructor_And_Initial_Weights) { + for (int i = 0; i < n_centers; ++i) { + EXPECT_EQ(rbf->get_weight(i), 0.0); + } +} + +// Main function for running tests +int main(int argc, char **argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +}