Skip to content

Commit e35c527

Browse files
refactor(libpath): terse xTests assertions
Switch unit-test assertion macros to xtests/terse-api.h short forms, leaving runner macros unchanged.
1 parent 2bc04ad commit e35c527

10 files changed

Lines changed: 3406 additions & 3405 deletions

File tree

‎CHANGES.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* Shortened example directory/source to **examples/cpp/parse/** / **main.cpp** (target **example.cpp.parse**; formerly **example.cpp.parse.1**);
1717
* Shortened unit-test directories to subject names under **test/unit/** (**compare**, **compare.C**, **equal**, **equal.C**, **parse**, **parse.C**, **shim-strings**, **type-strings**, **version**), with **entry.c** / **entry.cpp** sources and matching **test.unit.*** targets;
1818
* Shortened scratch **test.scratch.compare.models** to **test/scratch/compare-models/** (**main.cpp**; target **test.scratch.compare-models**);
19+
* Switched unit-test assertion statements to the **xTests** Terse API short forms (via **xtests/terse-api.h**);
1920
* Created **CHANGES.md** from **HISTORY.md** and removed the subsumed **HISTORY.md**; upgraded **NEWS.md** to a three-column chronology with **Details**;
2021
* Project boilerplate updates (**AUTHORS.md**, **FAQ.md**, **REQUISITES.md**, **TODO.md**, **LICENSE**, **README.md** CI badge and dependency links);
2122

‎test/unit/compare.C/entry.c‎

Lines changed: 377 additions & 377 deletions
Large diffs are not rendered by default.

‎test/unit/compare/entry.cpp‎

Lines changed: 376 additions & 376 deletions
Large diffs are not rendered by default.

‎test/unit/equal.C/entry.c‎

Lines changed: 149 additions & 149 deletions
Large diffs are not rendered by default.

‎test/unit/equal/entry.cpp‎

Lines changed: 149 additions & 149 deletions
Large diffs are not rendered by default.

‎test/unit/parse.C/entry.c‎

Lines changed: 1158 additions & 1158 deletions
Large diffs are not rendered by default.

‎test/unit/parse/entry.cpp‎

Lines changed: 1162 additions & 1162 deletions
Large diffs are not rendered by default.

‎test/unit/shim-strings/entry.cpp‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525

2626
/* xTests header files */
27-
#include <xtests/xtests.h>
27+
#include <xtests/terse-api.h>
2828
#if _XTESTS_VER < 0x00150000
2929
# error This code requires xTests 0.21.0, or later
3030
#endif
@@ -74,29 +74,29 @@ int main(int argc, char* argv[])
7474

7575
static void test_rc_known_values()
7676
{
77-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("operation is not supported", stlsoft::sas_to_string(LIBPATH_RC_OF(UnsupportedOperation)));
77+
TEST_MS_EQ("operation is not supported", stlsoft::sas_to_string(LIBPATH_RC_OF(UnsupportedOperation)));
7878

79-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("unexpected condition", stlsoft::sas_to_string(LIBPATH_RC_OF(UnexpectedCondition)));
79+
TEST_MS_EQ("unexpected condition", stlsoft::sas_to_string(LIBPATH_RC_OF(UnexpectedCondition)));
8080

81-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("out of memory", stlsoft::sas_to_string(LIBPATH_RC_OF(OutOfMemory)));
81+
TEST_MS_EQ("out of memory", stlsoft::sas_to_string(LIBPATH_RC_OF(OutOfMemory)));
8282

83-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("no path specified", stlsoft::sas_to_string(LIBPATH_RC_OF(NoPathSpecified)));
83+
TEST_MS_EQ("no path specified", stlsoft::sas_to_string(LIBPATH_RC_OF(NoPathSpecified)));
8484

85-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("bad path character", stlsoft::sas_to_string(LIBPATH_RC_OF(BadPathCharacter)));
85+
TEST_MS_EQ("bad path character", stlsoft::sas_to_string(LIBPATH_RC_OF(BadPathCharacter)));
8686

87-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("option not supported", stlsoft::sas_to_string(LIBPATH_RC_OF(OptionNotSupported)));
87+
TEST_MS_EQ("option not supported", stlsoft::sas_to_string(LIBPATH_RC_OF(OptionNotSupported)));
8888

89-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("invalid root", stlsoft::sas_to_string(LIBPATH_RC_OF(InvalidRoot)));
89+
TEST_MS_EQ("invalid root", stlsoft::sas_to_string(LIBPATH_RC_OF(InvalidRoot)));
9090

91-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("a reserved parameter that is reserved for future use must have the value 0 or NULL", stlsoft::sas_to_string(LIBPATH_RC_OF(ParameterIsReservedAndMustBeZero)));
91+
TEST_MS_EQ("a reserved parameter that is reserved for future use must have the value 0 or NULL", stlsoft::sas_to_string(LIBPATH_RC_OF(ParameterIsReservedAndMustBeZero)));
9292

93-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("first/only path parameter is invalid", stlsoft::sas_to_string(LIBPATH_RC_OF(FirstPathInvalid)));
93+
TEST_MS_EQ("first/only path parameter is invalid", stlsoft::sas_to_string(LIBPATH_RC_OF(FirstPathInvalid)));
9494

95-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("second path parameter is invalid", stlsoft::sas_to_string(LIBPATH_RC_OF(SecondPathInvalid)));
95+
TEST_MS_EQ("second path parameter is invalid", stlsoft::sas_to_string(LIBPATH_RC_OF(SecondPathInvalid)));
9696

97-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("working directory path parameter is invalid", stlsoft::sas_to_string(LIBPATH_RC_OF(WorkingDirectoryPathInvalid)));
97+
TEST_MS_EQ("working directory path parameter is invalid", stlsoft::sas_to_string(LIBPATH_RC_OF(WorkingDirectoryPathInvalid)));
9898

99-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("operation completed successfully", stlsoft::sas_to_string(LIBPATH_RC_OF(Success)));
99+
TEST_MS_EQ("operation completed successfully", stlsoft::sas_to_string(LIBPATH_RC_OF(Success)));
100100
}
101101

102102

‎test/unit/type-strings/entry.cpp‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525

2626
/* xTests header files */
27-
#include <xtests/xtests.h>
27+
#include <xtests/terse-api.h>
2828
#if _XTESTS_VER < 0x00150000
2929
# error This code requires xTests 0.21.0, or later
3030
#endif
@@ -82,84 +82,84 @@ static void test_rc_known_values()
8282
LIBPATH_RC const rc = LIBPATH_RC_OF(UnsupportedOperation);
8383
std::string const s = std::string(libpath_rc_getStringPtr(rc), libpath_rc_getStringLen(rc));
8484

85-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("operation is not supported", s);
85+
TEST_MS_EQ("operation is not supported", s);
8686
}
8787

8888
{
8989
LIBPATH_RC const rc = LIBPATH_RC_OF(UnexpectedCondition);
9090
std::string const s = std::string(libpath_rc_getStringPtr(rc), libpath_rc_getStringLen(rc));
9191

92-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("unexpected condition", s);
92+
TEST_MS_EQ("unexpected condition", s);
9393
}
9494

9595
{
9696
LIBPATH_RC const rc = LIBPATH_RC_OF(OutOfMemory);
9797
std::string const s = std::string(libpath_rc_getStringPtr(rc), libpath_rc_getStringLen(rc));
9898

99-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("out of memory", s);
99+
TEST_MS_EQ("out of memory", s);
100100
}
101101

102102
{
103103
LIBPATH_RC const rc = LIBPATH_RC_OF(NoPathSpecified);
104104
std::string const s = std::string(libpath_rc_getStringPtr(rc), libpath_rc_getStringLen(rc));
105105

106-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("no path specified", s);
106+
TEST_MS_EQ("no path specified", s);
107107
}
108108

109109
{
110110
LIBPATH_RC const rc = LIBPATH_RC_OF(BadPathCharacter);
111111
std::string const s = std::string(libpath_rc_getStringPtr(rc), libpath_rc_getStringLen(rc));
112112

113-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("bad path character", s);
113+
TEST_MS_EQ("bad path character", s);
114114
}
115115

116116
{
117117
LIBPATH_RC const rc = LIBPATH_RC_OF(OptionNotSupported);
118118
std::string const s = std::string(libpath_rc_getStringPtr(rc), libpath_rc_getStringLen(rc));
119119

120-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("option not supported", s);
120+
TEST_MS_EQ("option not supported", s);
121121
}
122122

123123
{
124124
LIBPATH_RC const rc = LIBPATH_RC_OF(InvalidRoot);
125125
std::string const s = std::string(libpath_rc_getStringPtr(rc), libpath_rc_getStringLen(rc));
126126

127-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("invalid root", s);
127+
TEST_MS_EQ("invalid root", s);
128128
}
129129

130130
{
131131
LIBPATH_RC const rc = LIBPATH_RC_OF(ParameterIsReservedAndMustBeZero);
132132
std::string const s = std::string(libpath_rc_getStringPtr(rc), libpath_rc_getStringLen(rc));
133133

134-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("a reserved parameter that is reserved for future use must have the value 0 or NULL", s);
134+
TEST_MS_EQ("a reserved parameter that is reserved for future use must have the value 0 or NULL", s);
135135
}
136136

137137
{
138138
LIBPATH_RC const rc = LIBPATH_RC_OF(FirstPathInvalid);
139139
std::string const s = std::string(libpath_rc_getStringPtr(rc), libpath_rc_getStringLen(rc));
140140

141-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("first/only path parameter is invalid", s);
141+
TEST_MS_EQ("first/only path parameter is invalid", s);
142142
}
143143

144144
{
145145
LIBPATH_RC const rc = LIBPATH_RC_OF(SecondPathInvalid);
146146
std::string const s = std::string(libpath_rc_getStringPtr(rc), libpath_rc_getStringLen(rc));
147147

148-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("second path parameter is invalid", s);
148+
TEST_MS_EQ("second path parameter is invalid", s);
149149
}
150150

151151
{
152152
LIBPATH_RC const rc = LIBPATH_RC_OF(WorkingDirectoryPathInvalid);
153153
std::string const s = std::string(libpath_rc_getStringPtr(rc), libpath_rc_getStringLen(rc));
154154

155-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("working directory path parameter is invalid", s);
155+
TEST_MS_EQ("working directory path parameter is invalid", s);
156156
}
157157

158158
{
159159
LIBPATH_RC const rc = LIBPATH_RC_OF(Success);
160160
std::string const s = std::string(libpath_rc_getStringPtr(rc), libpath_rc_getStringLen(rc));
161161

162-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("operation completed successfully", s);
162+
TEST_MS_EQ("operation completed successfully", s);
163163
}
164164
}
165165

@@ -169,7 +169,7 @@ static void test_rcx_known_values()
169169
LIBPATH_RCX const rcx = LIBPATH_RCX_OF(Success);
170170
std::string const s = std::string(libpath_rcx_getStringPtr(rcx), libpath_rcx_getStringLen(rcx));
171171

172-
XTESTS_TEST_MULTIBYTE_STRING_EQUAL("operation completed successfully", s);
172+
TEST_MS_EQ("operation completed successfully", s);
173173
}
174174

175175
}

‎test/unit/version/entry.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525

2626
/* xTests header files */
27-
#include <xtests/xtests.h>
27+
#include <xtests/terse-api.h>
2828

2929
/* STLSoft header files */
3030
#include <stlsoft/stlsoft.h>
@@ -76,12 +76,12 @@ static void test_version(void)
7676
unsigned const patch = (LIBPATH_VER >> 8) & 0xff;
7777
unsigned const relstatus = (LIBPATH_VER >> 0) & 0xff;
7878

79-
XTESTS_TEST_INTEGER_EQUAL_EXACT(LIBPATH_VER_MAJOR, major);
80-
XTESTS_TEST_INTEGER_EQUAL_EXACT(LIBPATH_VER_MINOR, minor);
81-
XTESTS_TEST_INTEGER_EQUAL_EXACT(LIBPATH_VER_PATCH, patch);
82-
XTESTS_TEST_INTEGER_EQUAL_EXACT(LIBPATH_VER_REVISION, patch);
83-
XTESTS_TEST_INTEGER_EQUAL_EXACT(LIBPATH_VER_RELSTATUS, relstatus);
84-
XTESTS_TEST_INTEGER_EQUAL_EXACT(LIBPATH_VER_ALPHABETA, relstatus);
79+
TEST_INTEGER_EQUAL_EXACT(LIBPATH_VER_MAJOR, major);
80+
TEST_INTEGER_EQUAL_EXACT(LIBPATH_VER_MINOR, minor);
81+
TEST_INTEGER_EQUAL_EXACT(LIBPATH_VER_PATCH, patch);
82+
TEST_INTEGER_EQUAL_EXACT(LIBPATH_VER_REVISION, patch);
83+
TEST_INTEGER_EQUAL_EXACT(LIBPATH_VER_RELSTATUS, relstatus);
84+
TEST_INTEGER_EQUAL_EXACT(LIBPATH_VER_ALPHABETA, relstatus);
8585
}
8686

8787

0 commit comments

Comments
 (0)