assert help


void test()
{
string fphrase;
apaxCompact("bob", fphrase);
assert(fphrase == "bob");
apaxCompact("bobby", fphrase);
assert(fphrase == "boby");

}


I can't seem to figure out how to make my assert work in order to test this function. I'm sure its just formatting that I can't seem to figure out.
Last edited on
apaxCompact("bob", fphrase);

Should that be fphrase = apaxCompact("bob", fphrase); ? If your function returns something, then do something with the returned value.
There's nothing wrong that I can see with your use of assert.

Can you tell us exactly what the problem is you're seeing? What, exactly, isn't working the way you expect it to?

Can you show us the definition of apaxCompact()?

I'll note that in your second call to apaxCompact(), you're passing "bobby", but in the subsequent assertion, you're checking for "boby".
The second assert fails because "bobby" != "boby" (2 b != 1 b) which is correct.
Topic archived. No new replies allowed.