Skip to content

Commit 808cabb

Browse files
Add Tests
1 parent c529ed3 commit 808cabb

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ set(ENSMALLEN_TESTS_SOURCES
1515
cmaes_test.cpp
1616
cne_test.cpp
1717
de_test.cpp
18+
delta_bar_delta_test.cpp
1819
demon_adam_test.cpp
1920
demon_sgd_test.cpp
2021
eve_test.cpp

tests/delta_bar_delta_test.cpp

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* @file delta_bar_detla_test.cpp
3+
* @author Ranjodh Singh
4+
*
5+
* ensmallen is free software; you may redistribute it and/or modify it under
6+
* the terms of the 3-clause BSD license. You should have received a copy of
7+
* the 3-clause BSD license along with ensmallen. If not, see
8+
* http://www.opensource.org/licenses/BSD-3-Clause for more information.
9+
*/
10+
#if defined(ENS_USE_COOT)
11+
#include <armadillo>
12+
#include <bandicoot>
13+
#endif
14+
#include <ensmallen.hpp>
15+
#include "catch.hpp"
16+
#include "test_function_tools.hpp"
17+
18+
using namespace ens;
19+
using namespace ens::test;
20+
21+
TEMPLATE_TEST_CASE("DeltaBarDelta_GDTestFunction", "[DeltaBarDelta]",
22+
arma::mat, arma::fmat)
23+
{
24+
DeltaBarDelta s(0.01, 500, 1e-9);
25+
FunctionTest<GDTestFunction, TestType>(s, 0.1, 0.01);
26+
}
27+
28+
TEMPLATE_TEST_CASE("DeltaBarDelta_RosenbrockFunction", "[DeltaBarDelta]",
29+
arma::mat, arma::fmat)
30+
{
31+
DeltaBarDelta s(0.001, 0, 1e-15);
32+
FunctionTest<RosenbrockFunction, TestType>(s, 0.01, 0.001);
33+
}
34+
35+
#ifdef ENS_HAVE_COOT
36+
37+
TEMPLATE_TEST_CASE("DeltaBarDelta_GDTestFunction", "[DeltaBarDelta]",
38+
coot::mat, coot::fmat)
39+
{
40+
DeltaBarDelta s(0.01, 500, 1e-9);
41+
FunctionTest<GDTestFunction, TestType>(s, 0.1, 0.01);
42+
}
43+
44+
TEMPLATE_TEST_CASE("DeltaBarDelta_RosenbrockFunction", "[DeltaBarDelta]",
45+
coot::mat, coot::fmat)
46+
{
47+
DeltaBarDelta s(0.001, 0, 1e-15);
48+
FunctionTest<RosenbrockFunction, TestType>(s, 0.01, 0.001);
49+
}
50+
51+
#endif

0 commit comments

Comments
 (0)