diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c index 392b88f85db..49dcb50b608 100644 --- a/dlls/vbscript/global.c +++ b/dlls/vbscript/global.c @@ -378,8 +378,18 @@ static HRESULT Global_CCur(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI static HRESULT Global_CInt(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + int val; + HRESULT hres; + + TRACE("%s\n", debugstr_variant(arg)); + + assert(args_cnt == 1); + + hres = to_int(arg, &val); + if(FAILED(hres)) + return hres; + + return return_int(res, val); } static HRESULT Global_CLng(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs index b6d8cd511cb..1151071a2f9 100644 --- a/dlls/vbscript/tests/api.vbs +++ b/dlls/vbscript/tests/api.vbs @@ -433,4 +433,27 @@ Call ok(getVT(vbYes) = "VT_I2", "getVT(vbYes) = " & getVT(vbYes)) Call ok(vbNo = 7, "vbNo = " & vbNo) Call ok(getVT(vbNo) = "VT_I2", "getVT(vbNo) = " & getVT(vbNo)) +Call ok(CInt(-36.75) = -37, "CInt(-36.75) = " & CInt(-36.75)) +Call ok(getVT(CInt(-36.75)) = "VT_I2", "getVT(CInt(-36.75)) = " & getVT(CInt(-36.75))) +Call ok(CInt(-36.50) = -36, "CInt(-36.50) = " & CInt(-36.50)) +Call ok(getVT(CInt(-36.50)) = "VT_I2", "getVT(CInt(-36.50)) = " & getVT(CInt(-36.50))) +Call ok(CInt(-36.25) = -36, "CInt(-36.25) = " & CInt(-36.25)) +Call ok(getVT(CInt(-36.25)) = "VT_I2", "getVT(CInt(-36.25)) = " & getVT(CInt(-36.25))) +Call ok(CInt(-36) = -36, "CInt(-36) = " & CInt(-36)) +Call ok(getVT(CInt(-36)) = "VT_I2", "getVT(CInt(-36)) = " & getVT(CInt(-36))) +Call ok(CInt(0) = 0, "CInt(0) = " & CInt(0)) +Call ok(getVT(CInt(0)) = "VT_I2", "getVT(CInt(0)) = " & getVT(CInt(0))) +Call ok(CInt(0.0) = 0, "CInt(0.0) = " & CInt(0)) +Call ok(getVT(CInt(0.0)) = "VT_I2", "getVT(CInt(0.0)) = " & getVT(CInt(0.0))) +Call ok(CInt(0.5) = 0, "CInt(0.5) = " & CInt(0)) +Call ok(getVT(CInt(0.5)) = "VT_I2", "getVT(CInt(0.5)) = " & getVT(CInt(0.5))) +Call ok(CInt(36) = 36, "CInt(36) = " & CInt(36)) +Call ok(getVT(CInt(36)) = "VT_I2", "getVT(CInt(36)) = " & getVT(CInt(36))) +Call ok(CInt(36.25) = 36, "CInt(36.25) = " & CInt(36.25)) +Call ok(getVT(CInt(36.25)) = "VT_I2", "getVT(CInt(36.25)) = " & getVT(CInt(36.25))) +Call ok(CInt(36.50) = 36, "CInt(36.50) = " & CInt(36.50)) +Call ok(getVT(CInt(36.50)) = "VT_I2", "getVT(CInt(36.50)) = " & getVT(CInt(36.50))) +Call ok(CInt(36.75) = 37, "CInt(36.75) = " & CInt(36.75)) +Call ok(getVT(CInt(36.75)) = "VT_I2", "getVT(CInt(36.75)) = " & getVT(CInt(36.75))) + Call reportSuccess()