comparison tests/src/plugins/joke/main.cpp @ 741:cc01813fa027

Tests: improve file naming consistency
author David Demelier <markand@malikania.fr>
date Wed, 25 Jul 2018 22:02:00 +0200
parents 64839725f346
children 791d7591eca7
comparison
equal deleted inserted replaced
740:7088476813ab 741:cc01813fa027
96 96
97 BOOST_AUTO_TEST_CASE(toobig) 97 BOOST_AUTO_TEST_CASE(toobig)
98 { 98 {
99 // xxx and yyy are both 3-lines which we disallow. only a must be said. 99 // xxx and yyy are both 3-lines which we disallow. only a must be said.
100 load({ 100 load({
101 { "file", CMAKE_CURRENT_SOURCE_DIR "/jokes-toobig.json" }, 101 { "file", CMAKE_CURRENT_SOURCE_DIR "/error-toobig.json" },
102 { "max-list-lines", "2" } 102 { "max-list-lines", "2" }
103 }); 103 });
104 104
105 std::unordered_map<std::string, int> said{ 105 std::unordered_map<std::string, int> said{
106 { "a", 0 } 106 { "a", 0 }
128 128
129 BOOST_AUTO_TEST_CASE(invalid) 129 BOOST_AUTO_TEST_CASE(invalid)
130 { 130 {
131 // Only a is the valid joke in this file. 131 // Only a is the valid joke in this file.
132 load({ 132 load({
133 { "file", CMAKE_CURRENT_SOURCE_DIR "/jokes-invalid.json" }, 133 { "file", CMAKE_CURRENT_SOURCE_DIR "/error-invalid.json" },
134 }); 134 });
135 135
136 std::unordered_map<std::string, int> said{ 136 std::unordered_map<std::string, int> said{
137 { "a", 0 } 137 { "a", 0 }
138 }; 138 };
171 BOOST_TEST(std::any_cast<std::string>(cmd[1]) == "error=test:#joke:jean!jean@localhost:jean"); 171 BOOST_TEST(std::any_cast<std::string>(cmd[1]) == "error=test:#joke:jean!jean@localhost:jean");
172 } 172 }
173 173
174 BOOST_AUTO_TEST_CASE(not_array) 174 BOOST_AUTO_TEST_CASE(not_array)
175 { 175 {
176 load({{"file", CMAKE_CURRENT_SOURCE_DIR "/jokes-not-array.json"}}); 176 load({{"file", CMAKE_CURRENT_SOURCE_DIR "/error-not-array.json"}});
177 177
178 plugin_->handle_command(irccd_, { server_, "jean!jean@localhost", "#joke", "" }); 178 plugin_->handle_command(irccd_, { server_, "jean!jean@localhost", "#joke", "" });
179 179
180 const auto cmd = server_->find("message").back(); 180 const auto cmd = server_->find("message").back();
181 181
183 BOOST_TEST(std::any_cast<std::string>(cmd[1]) == "error=test:#joke:jean!jean@localhost:jean"); 183 BOOST_TEST(std::any_cast<std::string>(cmd[1]) == "error=test:#joke:jean!jean@localhost:jean");
184 } 184 }
185 185
186 BOOST_AUTO_TEST_CASE(empty) 186 BOOST_AUTO_TEST_CASE(empty)
187 { 187 {
188 load({{"file", CMAKE_CURRENT_SOURCE_DIR "/jokes-empty.json"}}); 188 load({{"file", CMAKE_CURRENT_SOURCE_DIR "/error-empty.json"}});
189 189
190 plugin_->handle_command(irccd_, {server_, "jean!jean@localhost", "#joke", ""}); 190 plugin_->handle_command(irccd_, {server_, "jean!jean@localhost", "#joke", ""});
191 191
192 const auto cmd = server_->find("message").back(); 192 const auto cmd = server_->find("message").back();
193 193