Skip to content

Commit a6d3df5

Browse files
ensure c string is used in objc side
1 parent 2390479 commit a6d3df5

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

code/tests/cases/test_bdd.m

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -106,32 +106,32 @@
106106
FOSSIL_TEST(objc_xbdd_valid_login) {
107107
GIVEN("a registered user with valid credentials") {
108108
// Set up the context
109-
std::string validUsername = "user123";
110-
std::string validPassword = "pass456";
109+
const char *validUsername = "user123";
110+
const char *validPassword = "pass456";
111111

112112
WHEN("the user provides correct username and password") {
113113
// Perform the action of user login
114-
std::string inputUsername = "user123";
115-
std::string inputPassword = "pass456";
114+
const char *inputUsername = "user123";
115+
const char *inputPassword = "pass456";
116116

117117
THEN("the login should be successful") {
118118
// Check the expected outcome
119119
// Simulate login validation
120-
FOSSIL_TEST_ASSUME(inputUsername == validUsername, "Username should match");
121-
FOSSIL_TEST_ASSUME(inputPassword == validPassword, "Password should match");
120+
FOSSIL_TEST_ASSUME(strcmp(inputUsername, validUsername) == 0, "Username should match");
121+
FOSSIL_TEST_ASSUME(strcmp(inputPassword, validPassword) == 0, "Password should match");
122122
}
123123
}
124124

125125
WHEN("the user provides incorrect password") {
126126
// Perform the action of user login
127-
std::string inputUsername = "user123";
128-
std::string inputPassword = "wrongpass";
127+
const char *inputUsername = "user123";
128+
const char *inputPassword = "wrongpass";
129129

130130
THEN("the login should fail with an error message") {
131131
// Check the expected outcome
132132
// Simulate login validation
133-
FOSSIL_TEST_ASSUME(inputUsername == validUsername, "Username should match");
134-
FOSSIL_TEST_ASSUME(inputPassword != validPassword, "Password should not match");
133+
FOSSIL_TEST_ASSUME(strcmp(inputUsername, validUsername) == 0, "Username should match");
134+
FOSSIL_TEST_ASSUME(strcmp(inputPassword, validPassword) != 0, "Password should not match");
135135
}
136136
}
137137
}
@@ -140,19 +140,19 @@
140140
FOSSIL_TEST(objc_xbdd_invalid_login) {
141141
GIVEN("a registered user with valid credentials") {
142142
// Set up the context
143-
std::string validUsername = "user123";
144-
std::string validPassword = "pass456";
143+
const char *validUsername = "user123";
144+
const char *validPassword = "pass456";
145145

146146
WHEN("the user provides incorrect username") {
147147
// Perform the action of user login
148-
std::string inputUsername = "wronguser";
149-
std::string inputPassword = "pass456";
148+
const char *inputUsername = "wronguser";
149+
const char *inputPassword = "pass456";
150150

151151
THEN("the login should fail with an error message") {
152152
// Check the expected outcome
153153
// Simulate login validation
154-
FOSSIL_TEST_ASSUME(inputUsername != validUsername, "Username should not match");
155-
FOSSIL_TEST_ASSUME(inputPassword == validPassword, "Password should match");
154+
FOSSIL_TEST_ASSUME(strcmp(inputUsername, validUsername) != 0, "Username should not match");
155+
FOSSIL_TEST_ASSUME(strcmp(inputPassword, validPassword) == 0, "Password should match");
156156
}
157157
}
158158
}

0 commit comments

Comments
 (0)