Thank you for commenting.
2014-04-29 21:30 GMT+08:00 Piotr Caban piotr.caban@gmail.com:
On 04/29/14 15:06, Shuai Meng wrote:
- if(!res)
return S_OK;
You can't return early if res is NULL. You still need to do the conversion and return error if it fails.
I don't quite get it, do you mean I should do like this: if(res) { .... } return S_OK;
+Call ok(CBool(Empty) = False, "CBool(Empty) = " & CBool(Empty))
+Call ok(getVT(CBool(Empty)) = "VT_BOOL", "getVT(CBool(Empty)) = " & getVT(CBool(Empty))) +Call ok(CBool(1) = True, "CBool(1) = " & CBool(1)) +Call ok(getVT(CBool(1)) = "VT_BOOL", "getVT(CBool(1)) = " & getVT(CBool(1))) +Call ok(CBool(0) = False, "CBool(0) = " & CBool(0)) +Call ok(getVT(CBool(0)) = "VT_BOOL", "getVT(CBool(0)) = " & getVT(CBool(0))) +Call ok(CBool(-0.56) = True, "CBool(-0.56) = " & CBool(-0.56)) +Call ok(getVT(CBool(-0.56)) = "VT_BOOL", "getVT(CBool(-0.56)) = " & getVT(CBool(-0.56))) +Call ok(CBool("-1") = True, "CBool(""-1"") = " & CBool("-1")) +Call ok(getVT(CBool("-1")) = "VT_BOOL", "getVT(CBool(""-1"")) = " & getVT(CBool("-1")))
It would be nice to add following tests (these are the tests Jacek was asking for):
Call ok(CBool("True") = true, "CBool(""True"") = " & CBool("True"))
Call ok(CBool("fAlSe") = false, "CBool(""fAlSe"") = " & CBool("fAlSe"))
I do notice it, but they failed in testbot. Just as MSDN says, If *expression* can't be interpreted as a numeric value, a run-time error occurs.
sub testCBoolError
on error resume next call Err.clear() call CBool("#FALSE#") call ok(Err.number = 458, "Err.number = " & Err.number)
end sub Call testCBoolError
Is this function written to provoke an error on purpose in order to test
CBool("#FALSE#")? Can CBool("True") assume the same form? Because CBool("True") always fails in testbot as I have said.