Hi,
Some of the tests are not working on windows: E:>vbscript_crosstest.exe run run.c:1043: Test failed: api.vbs: L"String(1, 564) = 4" run.c:1043: Test failed: api.vbs: L"String(1, 16895.49) = \00ff" run.c:1043: Test failed: api.vbs: L"String(1, CSng(16895.5)) = " run.c:1043: Test failed: api.vbs: L"755826670, w: Err.number = 0" run: 26885 tests executed (0 marked as todo, 4 failures), 0 skipped.
On 10/25/14 10:10, Shuai Meng wrote:
+Call ok(String(1, 65.5) = "B", "String(1, 65.5) = " & String(1, 65.5)) +Call ok(getVT(String(1, 65.5)) = "VT_BSTR", "getVT(String(1, 65.5)) = " & getVT(String(1, 65.5))) +Call ok(String(1, 66.5) = "B", "String(1, 66.5) = " & String(1, 66.5)) +Call ok(getVT(String(1, 66.5)) = "VT_BSTR", "getVT(String(1, 66.5)) = " & getVT(String(1, 66.5)))
You have added exactly the same test twice.
+Call testStringError(2147483648, "w", 6) +Call testStringError(2147483647, "w", 5) +Call testStringError(1073741824, "w", 5) +Call testStringError(1073741823, "w", 14) +Call testStringError(755826670, "w", 14) +Call testStringError(755826669, "w", 0)
You can't assume it's possible to allocate ~700mb of memory in tests.
The function never returns E_OUTOFMEMORY. You can't test it in wine tests suite but you can see it by calling the function in loop until system runs out of memory and then checking the error. You should simply try to allocate the string and if it fails return VBSE_OUT_OF_STRING_SPACE.
Cheers, Piotr
Hi Piotr, thanks for commenting.
2014-10-25 19:03 GMT+08:00 Piotr Caban piotr.caban@gmail.com:
Hi,
Some of the tests are not working on windows: E:>vbscript_crosstest.exe run run.c:1043: Test failed: api.vbs: L"String(1, 564) = 4"
I have tested this for many times, but it is very strange that the result of String(1, 564) varies with different platforms, running in cmd on xp, it equals to String(1, 564 / 256) while equals to String(1, 564 mod 256) running directly in vbs script(meaning save vbs code as test.vbs and double click it). That confuses me a lot, according to MSDN documents, it should equal to String(1, 564 mod 256), I don't know how to handle it.
run.c:1043: Test failed: api.vbs: L"String(1, 16895.49) = \00ff"
run.c:1043: Test failed: api.vbs: L"String(1, CSng(16895.5)) = "
They are the same problem.
run.c:1043: Test failed: api.vbs: L"755826670, w: Err.number = 0" run: 26885 tests executed (0 marked as todo, 4 failures), 0 skipped.
On 10/25/14 10:10, Shuai Meng wrote:
+Call ok(String(1, 65.5) = "B", "String(1, 65.5) = " & String(1, 65.5)) +Call ok(getVT(String(1, 65.5)) = "VT_BSTR", "getVT(String(1, 65.5)) = " & getVT(String(1, 65.5))) +Call ok(String(1, 66.5) = "B", "String(1, 66.5) = " & String(1, 66.5)) +Call ok(getVT(String(1, 66.5)) = "VT_BSTR", "getVT(String(1, 66.5)) = " & getVT(String(1, 66.5)))
You have added exactly the same test twice.
+Call testStringError(2147483648, "w", 6)
+Call testStringError(2147483647, "w", 5) +Call testStringError(1073741824, "w", 5) +Call testStringError(1073741823, "w", 14) +Call testStringError(755826670, "w", 14) +Call testStringError(755826669, "w", 0)
You can't assume it's possible to allocate ~700mb of memory in tests.
The function never returns E_OUTOFMEMORY. You can't test it in wine tests suite but you can see it by calling the function in loop until system runs out of memory and then checking the error. You should simply try to allocate the string and if it fails return VBSE_OUT_OF_STRING_SPACE.
I will check it later.
Cheers, Piotr
On Wed, 29 Oct 2014 17:57:15 +0800, Shuai Meng wrote:
I have tested this for many times, but it is very strange that the result of String(1, 564) varies with different platforms, running in cmd on xp, it equals to String(1, 564 / 256) while equals to String(1, 564 mod 256) running directly in vbs script(meaning save vbs code as test.vbs and double click it). That confuses me a lot, according to MSDN documents, it should equal to String(1, 564 mod 256), I don't know how to handle it.
Hello Shuai,
Despite MSDN documents, VBScript String function accepts double-byte character code in DBCS locale based on my tests. That means you can specify like String(3, &HE0E0) where &HE0E0 is an ANSI codepage character code not a Unicode codepoint. I guess String(1, 564) is internally interpreted as "\x02\x34" in DBCS locale. As you know, \x02 isn't a valid lead-byte character, so, you got "\x02". On the other hand, in SBCS locale, VBScript engine did 564 mod 256, thus, Piotr got "4".
Regards, Akihiro Sagawa
Thanks very much for commenting, I'm trying to fix this.
2014-10-29 23:14 GMT+08:00 Akihiro Sagawa sagawa.aki@gmail.com:
On Wed, 29 Oct 2014 17:57:15 +0800, Shuai Meng wrote:
I have tested this for many times, but it is very strange that the
result
of String(1, 564) varies with different platforms, running in cmd on xp, it equals to String(1, 564 / 256) while equals to String(1, 564 mod 256) running directly in vbs script(meaning save vbs code as test.vbs and
double
click it). That confuses me a lot, according to MSDN documents, it should equal to String(1, 564 mod 256), I don't know how to handle it.
Hello Shuai,
Despite MSDN documents, VBScript String function accepts double-byte character code in DBCS locale based on my tests. That means you can specify like String(3, &HE0E0) where &HE0E0 is an ANSI codepage character code not a Unicode codepoint. I guess String(1, 564) is internally interpreted as "\x02\x34" in DBCS locale. As you know, \x02 isn't a valid lead-byte character, so, you got "\x02". On the other hand, in SBCS locale, VBScript engine did 564 mod 256, thus, Piotr got "4".
Regards, Akihiro Sagawa