|
106 | 106 | FOSSIL_TEST(objc_xbdd_valid_login) { |
107 | 107 | GIVEN("a registered user with valid credentials") { |
108 | 108 | // Set up the context |
109 | | - std::string validUsername = "user123"; |
110 | | - std::string validPassword = "pass456"; |
| 109 | + const char *validUsername = "user123"; |
| 110 | + const char *validPassword = "pass456"; |
111 | 111 |
|
112 | 112 | WHEN("the user provides correct username and password") { |
113 | 113 | // 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"; |
116 | 116 |
|
117 | 117 | THEN("the login should be successful") { |
118 | 118 | // Check the expected outcome |
119 | 119 | // 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"); |
122 | 122 | } |
123 | 123 | } |
124 | 124 |
|
125 | 125 | WHEN("the user provides incorrect password") { |
126 | 126 | // 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"; |
129 | 129 |
|
130 | 130 | THEN("the login should fail with an error message") { |
131 | 131 | // Check the expected outcome |
132 | 132 | // 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"); |
135 | 135 | } |
136 | 136 | } |
137 | 137 | } |
|
140 | 140 | FOSSIL_TEST(objc_xbdd_invalid_login) { |
141 | 141 | GIVEN("a registered user with valid credentials") { |
142 | 142 | // Set up the context |
143 | | - std::string validUsername = "user123"; |
144 | | - std::string validPassword = "pass456"; |
| 143 | + const char *validUsername = "user123"; |
| 144 | + const char *validPassword = "pass456"; |
145 | 145 |
|
146 | 146 | WHEN("the user provides incorrect username") { |
147 | 147 | // 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"; |
150 | 150 |
|
151 | 151 | THEN("the login should fail with an error message") { |
152 | 152 | // Check the expected outcome |
153 | 153 | // 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"); |
156 | 156 | } |
157 | 157 | } |
158 | 158 | } |
|
0 commit comments