1313 * -----------------------------------------------------------------------------
1414 */
1515#include < fossil/test/framework.h>
16+ #include < string>
1617
1718// * * * * * * * * * * * * * * * * * * * * * * * *
1819// * Fossil Logic Test Utilites
@@ -106,32 +107,32 @@ FOSSIL_TEST_CASE(cpp_xbdd_empty_cart) {
106107FOSSIL_TEST_CASE (cpp_xbdd_valid_login) {
107108 GIVEN (" a registered user with valid credentials" ) {
108109 // Set up the context
109- const char * validUsername = " user123" ;
110- const char * validPassword = " pass456" ;
110+ std::string validUsername = " user123" ;
111+ std::string validPassword = " pass456" ;
111112
112113 WHEN (" the user provides correct username and password" ) {
113114 // Perform the action of user login
114- const char * inputUsername = " user123" ;
115- const char * inputPassword = " pass456" ;
115+ std::string inputUsername = " user123" ;
116+ std::string inputPassword = " pass456" ;
116117
117118 THEN (" the login should be successful" ) {
118119 // Check the expected outcome
119120 // Simulate login validation
120- FOSSIL_TEST_ASSUME (strcmp ( inputUsername, validUsername) == 0 , " Username should match" );
121- FOSSIL_TEST_ASSUME (strcmp ( inputPassword, validPassword) == 0 , " Password should match" );
121+ FOSSIL_TEST_ASSUME (inputUsername == validUsername , " Username should match" );
122+ FOSSIL_TEST_ASSUME (inputPassword == validPassword , " Password should match" );
122123 }
123124 }
124125
125126 WHEN (" the user provides incorrect password" ) {
126127 // Perform the action of user login
127- const char * inputUsername = " user123" ;
128- const char * inputPassword = " wrongpass" ;
128+ std::string inputUsername = " user123" ;
129+ std::string inputPassword = " wrongpass" ;
129130
130131 THEN (" the login should fail with an error message" ) {
131132 // Check the expected outcome
132133 // Simulate login validation
133- FOSSIL_TEST_ASSUME (strcmp ( inputUsername, validUsername) == 0 , " Username should match" );
134- FOSSIL_TEST_ASSUME (strcmp ( inputPassword, validPassword) != 0 , " Password should not match" );
134+ FOSSIL_TEST_ASSUME (inputUsername == validUsername , " Username should match" );
135+ FOSSIL_TEST_ASSUME (inputPassword != validPassword , " Password should not match" );
135136 }
136137 }
137138 }
@@ -140,19 +141,19 @@ FOSSIL_TEST_CASE(cpp_xbdd_valid_login) {
140141FOSSIL_TEST_CASE (cpp_xbdd_invalid_login) {
141142 GIVEN (" a registered user with valid credentials" ) {
142143 // Set up the context
143- const char * validUsername = " user123" ;
144- const char * validPassword = " pass456" ;
144+ std::string validUsername = " user123" ;
145+ std::string validPassword = " pass456" ;
145146
146147 WHEN (" the user provides incorrect username" ) {
147148 // Perform the action of user login
148- const char * inputUsername = " wronguser" ;
149- const char * inputPassword = " pass456" ;
149+ std::string inputUsername = " wronguser" ;
150+ std::string inputPassword = " pass456" ;
150151
151152 THEN (" the login should fail with an error message" ) {
152153 // Check the expected outcome
153154 // Simulate login validation
154- FOSSIL_TEST_ASSUME (strcmp ( inputUsername, validUsername) != 0 , " Username should not match" );
155- FOSSIL_TEST_ASSUME (strcmp ( inputPassword, validPassword) == 0 , " Password should match" );
155+ FOSSIL_TEST_ASSUME (inputUsername != validUsername , " Username should not match" );
156+ FOSSIL_TEST_ASSUME (inputPassword == validPassword , " Password should match" );
156157 }
157158 }
158159 }
0 commit comments