Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0f95aae

Browse files
committed
Tests updated.
1 parente3d732f commit0f95aae

File tree

4 files changed

+29
-12
lines changed

4 files changed

+29
-12
lines changed

‎src/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ enable_testing()
3838

3939
add_executable(
4040
cctest
41+
${CMAKE_CURRENT_SOURCE_DIR}/helpers/formatter.cpp
4142
${CMAKE_CURRENT_SOURCE_DIR}/options-parser.cpp
4243
${CMAKE_CURRENT_SOURCE_DIR}/tests/args-test.cpp
4344
)

‎src/options-parser.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ typedef struct
1919
bool is_rewrite{false};
2020
bool is_nodeutils{false};
2121
bool is_noconfig{false};
22-
boolis_nomon{false};
22+
boolis_nocanmon{false};
2323
bool is_nofmon{false};
2424
bool is_help{false};
2525
} ParamConfig_t;

‎src/tests/args-test.cpp‎

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include<gtest/gtest.h>
1+
#include"testapi.h"
22
#include<options-parser.h>
33

44
TEST(ArgParserTest, BasicAssert)
@@ -10,19 +10,28 @@ TEST(ArgParserTest, BasicAssert)
1010
(char*)"path/to/out",
1111
(char*)"-dbc",
1212
(char*)"path/to/test.dbc",
13+
(char*)"-drvname",
14+
(char*)"testdbc",
1315
(char*)"-rw"
1416
};
1517

1618
OptionsParser parser;
17-
auto ret = parser.GetOptions(6, testchunks);
18-
EXPECT_TRUE(ret.size() ==3);
19+
auto ret = parser.GetOptions(9, testchunks);
1920

20-
EXPECT_EQ(ret[0].first.compare("-out"),0);
21-
EXPECT_EQ(ret[0].second.compare("path/to/out"),0);
22-
EXPECT_EQ(ret[1].first.compare("-dbc"),0);
23-
EXPECT_EQ(ret[1].second.compare("path/to/test.dbc"),0);
24-
EXPECT_EQ(ret[2].first.compare("-rw"),0);
25-
EXPECT_EQ(ret[2].second.size(),0);
21+
expect_true(ret.dbc.ok);
22+
expect_true(ret.dbc.value.compare("path/to/test.dbc") ==0);
2623

27-
EXPECT_EQ(1,1);
28-
}
24+
expect_true(ret.outdir.ok);
25+
expect_true(ret.outdir.value.compare("path/to/out") ==0);
26+
27+
expect_true(ret.drvname.ok);
28+
expect_true(ret.drvname.value.compare("testdbc") ==0);
29+
expect_true(ret.is_rewrite);
30+
31+
expect_false(ret.is_help);
32+
expect_false(ret.is_noconfig);
33+
expect_false(ret.is_nodeutils);
34+
expect_false(ret.is_nofmon);
35+
expect_false(ret.is_nocanmon);
36+
37+
}

‎src/tests/testapi.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#pragma once
2+
3+
#include<gtest/gtest.h>
4+
5+
#defineexpect_eq EXPECT_EQ
6+
#defineexpect_true EXPECT_TRUE
7+
#defineexpect_false EXPECT_FALSE

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp