diff --git a/tests/fann_test.cpp b/tests/fann_test.cpp index 7ba9fec8..42d2da41 100644 --- a/tests/fann_test.cpp +++ b/tests/fann_test.cpp @@ -61,7 +61,7 @@ void FannTest::AssertWeights(neural_net &net, fann_type min, fann_type max, fann TEST_F(FannTest, CreateStandardThreeLayers) { neural_net net(LAYER, 3, 2, 3, 4); - AssertCreateAndCopy(net, 3, (unsigned int[]) {2, 3, 4}, 11, 25); + AssertCreateAndCopy(net, 3, (const unsigned int[]) {2, 3, 4}, 11, 25); } TEST_F(FannTest, CreateStandardThreeLayersUsingCreateMethod) { @@ -90,12 +90,12 @@ TEST_F(FannTest, CreateStandardFourLayersVector) { TEST_F(FannTest, CreateSparseFourLayers) { neural_net net(0.5, 4, 2, 3, 4, 5); - AssertCreateAndCopy(net, 4, (unsigned int[]){2, 3, 4, 5}, 17, 31); + AssertCreateAndCopy(net, 4, (const unsigned int[]){2, 3, 4, 5}, 17, 31); } TEST_F(FannTest, CreateSparseFourLayersUsingCreateMethod) { ASSERT_TRUE(net.create_sparse(0.5f, 4, 2, 3, 4, 5)); - AssertCreateAndCopy(net, 4, (unsigned int[]){2, 3, 4, 5}, 17, 31); + AssertCreateAndCopy(net, 4, (const unsigned int[]){2, 3, 4, 5}, 17, 31); } TEST_F(FannTest, CreateSparseArrayFourLayers) { @@ -118,13 +118,13 @@ TEST_F(FannTest, CreateSparseArrayWithMinimalConnectivity) { TEST_F(FannTest, CreateShortcutFourLayers) { neural_net net(SHORTCUT, 4, 2, 3, 4, 5); - AssertCreateAndCopy(net, 4, (unsigned int[]){2, 3, 4, 5}, 15, 83); + AssertCreateAndCopy(net, 4, (const unsigned int[]){2, 3, 4, 5}, 15, 83); EXPECT_EQ(SHORTCUT, net.get_network_type()); } TEST_F(FannTest, CreateShortcutFourLayersUsingCreateMethod) { ASSERT_TRUE(net.create_shortcut(4, 2, 3, 4, 5)); - AssertCreateAndCopy(net, 4, (unsigned int[]){2, 3, 4, 5}, 15, 83); + AssertCreateAndCopy(net, 4, (const unsigned int[]){2, 3, 4, 5}, 15, 83); EXPECT_EQ(SHORTCUT, net.get_network_type()); } @@ -148,7 +148,7 @@ TEST_F(FannTest, CreateFromFile) { ASSERT_TRUE(netToBeSaved.save("tmpfile")); neural_net netToBeLoaded("tmpfile"); - AssertCreateAndCopy(netToBeLoaded, 3, (unsigned int[]){2, 3, 4}, 11, 25); + AssertCreateAndCopy(netToBeLoaded, 3, (const unsigned int[]){2, 3, 4}, 11, 25); } TEST_F(FannTest, CreateFromFileUsingCreateMethod) { @@ -158,7 +158,7 @@ TEST_F(FannTest, CreateFromFileUsingCreateMethod) { ASSERT_TRUE(net.create_from_file("tmpfile")); - AssertCreateAndCopy(net, 3, (unsigned int[]){2, 3, 4}, 11, 25); + AssertCreateAndCopy(net, 3, (const unsigned int[]){2, 3, 4}, 11, 25); } TEST_F(FannTest, RandomizeWeights) { diff --git a/tests/fann_test_train.cpp b/tests/fann_test_train.cpp index bd7c0edd..c68b334a 100644 --- a/tests/fann_test_train.cpp +++ b/tests/fann_test_train.cpp @@ -25,10 +25,10 @@ TEST_F(FannTestTrain, TrainSimpleIncrementalXor) { neural_net net(LAYER, 3, 2, 3, 1); for(int i = 0; i < 100000; i++) { - net.train((fann_type[]) {0.0, 0.0}, (fann_type[]) {0.0}); - net.train((fann_type[]) {1.0, 0.0}, (fann_type[]) {1.0}); - net.train((fann_type[]) {0.0, 1.0}, (fann_type[]) {1.0}); - net.train((fann_type[]) {1.0, 1.0}, (fann_type[]) {0.0}); + net.train((fann_type*) (const fann_type[]) {0.0, 0.0}, (fann_type*) (const fann_type[]) {0.0}); + net.train((fann_type*) (const fann_type[]) {1.0, 0.0}, (fann_type*) (const fann_type[]) {1.0}); + net.train((fann_type*) (const fann_type[]) {0.0, 1.0}, (fann_type*) (const fann_type[]) {1.0}); + net.train((fann_type*) (const fann_type[]) {1.0, 1.0}, (fann_type*) (const fann_type[]) {0.0}); } EXPECT_LT(net.get_MSE(), 0.01);