1 #include "bandit/bandit/bandit.h"
2 // BANDIT NEEDS TO BE INCLUDED FIRST!!!
3 
4 #include <iostream>
5 #include "../../src/modules.h"
6 
7 bool is_alias(const std::string &);
8 
9 const std::string alias_name = "alias1-1";
10 void *
testFunction(void * test)11 testFunction(void *test)
12 {
13   return test;
14 }
15 static const module_t module_with_alias = { "aliasModule",
16                                             testFunction,
17                                             {},
18                                             { "oper1-1", "oper1-2" },
19                                             1,
20                                             0,
21                                             1,
22                                             1,
23                                             NoRestriction,
24                                             { Alias(alias_name, "oper1-1") } };
25 
26 using namespace snowhouse;
27 
__anon23e06b0f0102() 28 go_bandit([]() {
29   bandit::describe("Testing for registered module with alias", [&]() {
30     bandit::it("has registered the module",
31                [&]() { AssertThat(get_modules(), Is().OfLength(1)); });
32     bandit::it(
33         "has added both operators to module map while not adding the alias",
34         [&]() { AssertThat(get_module_map(), Is().OfLength(2)); });
35     bandit::it("has registered the alias",
36                [&]() { AssertThat(get_aliases(), Is().OfLength(1)); });
37     bandit::it("has registered the correct original name", [&]() {
38       AssertThat(get_aliases()[alias_name], Is().EqualTo("oper1-1"));
39     });
40   });
41   bandit::describe("Testing the interface for alias and name retreval", [&]() {
42     bandit::it("gets the right name for alias", [&]() {
43       AssertThat(get_original(alias_name.c_str()), Is().EqualTo("oper1-1"));
44     });
45     bandit::it("extracts the operator name", [&]() {
46       AssertThat(get_original("oper1-1"), Is().EqualTo("oper1-1"));
47     });
48     bandit::it("recognizes an alias",
49                [&]() { AssertThat(is_alias(alias_name), IsTrue()); });
50   });
51 });
52 
53 int
main(int argc,char ** argv)54 main(int argc, char **argv)
55 {
56 
57   int result = bandit::run(argc, argv);
58 
59   return result;
60 }
61