| 6 | #include "gtest/gtest.h" |
| 7 | |
| 8 | class CMDTest : public testing::Test { |
| 9 | protected: |
| 10 | CMDParser cmdParser; |
| 11 | SvmParam ¶m = cmdParser.param_cmd; |
| 12 | static const int max_args = 64; |
| 13 | const string traing_file_name = "train_dataset"; |
| 14 | const string test_file_name = "test_dataset"; |
| 15 | const string model_file_name = "model"; |
| 16 | const float float_max_error = 1e-5; |
| 17 | int argc; |
| 18 | char *argv[max_args]; |
| 19 | |
| 20 | void read_cmd(string cmd) { |
| 21 | //reset to default |
| 22 | argc = 0; |
| 23 | param = SvmParam(); |
| 24 | |
| 25 | //convert command line to argc and argv |
| 26 | char *p2 = strtok(const_cast<char *>(cmd.c_str()), " "); |
| 27 | while (p2 && argc < max_args) { |
| 28 | argv[argc++] = p2; |
| 29 | p2 = strtok(NULL, " "); |
| 30 | } |
| 31 | //parse command |
| 32 | cmdParser.parse_command_line(argc, argv); |
| 33 | } |
| 34 | }; |
| 35 | |
| 36 | TEST_F(CMDTest, test_default) { |
| 37 | read_cmd("thundersvm-train " + traing_file_name); |
nothing calls this directly
no outgoing calls
no test coverage detected