algorithms_tests.cpp
Go to the documentation of this file.
1 // Copyright 2019, University of Maryland and the MANGO development team.
2 //
3 // This file is part of MANGO.
4 //
5 // MANGO is free software: you can redistribute it and/or modify it
6 // under the terms of the GNU Lesser General Public License as
7 // published by the Free Software Foundation, either version 3 of the
8 // License, or (at your option) any later version.
9 //
10 // MANGO is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with MANGO. If not, see
17 // <https://www.gnu.org/licenses/>.
18 
19 #include "catch.hpp"
20 #include "mango.hpp"
21 
22 
23 TEST_CASE("does_algorithm_exist(): Verify that return value is true for all the algorithms.","[algorithms]") {
24  for (int j = 0; j < mango::NUM_ALGORITHMS; j++) {
26  }
27 }
28 
29 TEST_CASE("does_algorithm_exist(): Verify that return value is false for a bunch of strings that are not algorithm names.","[algorithms]") {
30  CHECK(!mango::does_algorithm_exist(" "));
31  for (int j = 0; j < mango::NUM_ALGORITHMS; j++) {
32  CHECK(!mango::does_algorithm_exist(mango::algorithms[j].name + " "));
33  CHECK(!mango::does_algorithm_exist(" " + mango::algorithms[j].name));
34  }
35 }
36 
37 TEST_CASE("get_algorithm(): Verify that return value is consistent with the algorithms array.","[algorithms]") {
38  for (int j = 0; j < mango::NUM_ALGORITHMS; j++) {
41  CHECK(alg == j);
42  }
43 }
TEST_CASE
TEST_CASE("does_algorithm_exist(): Verify that return value is true for all the algorithms.","[algorithms]")
Definition: algorithms_tests.cpp:23
mango::get_algorithm
bool get_algorithm(std::string name, algorithm_type *algorithm_int)
Returns the integer (enum) for an optimization algorithm associated with its string name.
Definition: algorithms.cpp:49
mango::does_algorithm_exist
bool does_algorithm_exist(std::string algorithm_name)
Checks whether or not a string corresponds to the name of one of the optimization algorithms known by...
Definition: algorithms.cpp:72
mango::algorithm_type
algorithm_type
A list of the algorithms that MANGO can potentially use.
Definition: mango.hpp:75
mango::algorithms
const algorithm_properties algorithms[NUM_ALGORITHMS]
A database of the algorithms that MANGO is aware of, including various properties of each algorithm.
Definition: mango.hpp:124
mango.hpp
mango::NUM_ALGORITHMS
@ NUM_ALGORITHMS
Not an actual algorithm, just counting.
Definition: mango.hpp:117