Adding rbf model tests. First test.

This commit is contained in:
Andru Liu
2024-10-08 21:52:45 -07:00
parent abc539b0fd
commit 7717b50da6
+34
View File
@@ -0,0 +1,34 @@
#include <gtest/gtest.h>
#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();
}