Solved Comapring value of same character array using Qverify fails Qtest
-
Dear Developers,
I am comparing two same character arrays using QVERIFY as given below. But it gives me negative result. Can you please explain me reason for it. Please inform me if you need any other infromation from me.
void TestGPIO::test_Compare_String()
{
char outputString[4]="30";
if(strcmp(outputString,"30")==0)
{
qDebug() << "Strings are equal";} else { qDebug() << "Strings not equal"; } QVERIFY(outputString=="30") ;
}
-
This post is deleted! -
@saurabh162 said in Comapring value of same character array using Qverify fails Qtest:
QVERIFY(outputString=="30") ;
This can't work as you're comparing pointers.
Use strcmp to compare two C style strings. -
This post is deleted!