Commit 13fe9147 authored by Shuai Meng's avatar Shuai Meng Committed by Alexandre Julliard

vbscript: Implemented IsNumeric.

parent f8f8964a
......@@ -91,6 +91,15 @@ static HRESULT return_bstr(VARIANT *res, BSTR str)
return S_OK;
}
static HRESULT return_bool(VARIANT *res, BOOL val)
{
if(res) {
V_VT(res) = VT_BOOL;
V_BOOL(res) = val ? VARIANT_TRUE : VARIANT_FALSE;
}
return S_OK;
}
static HRESULT return_short(VARIANT *res, short val)
{
if(res) {
......@@ -600,8 +609,16 @@ static HRESULT Global_IsNull(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VA
static HRESULT Global_IsNumeric(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
{
FIXME("\n");
return E_NOTIMPL;
HRESULT hres;
double d;
TRACE("(%s)\n", debugstr_variant(arg));
assert(args_cnt == 1);
hres = to_double(arg, &d);
return return_bool(res, SUCCEEDED(hres));
}
static HRESULT Global_IsArray(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
......
'
' Copyright 2011 Jacek Caban for CodeWeavers
'
' This library is free software; you can redistribute it and/or
......@@ -195,6 +194,31 @@ Call ok(not isNull(4), "isNull(4) is true?")
Call ok(not isNull("x"), "isNull(""x"") is true?")
Call ok(isNull(Null), "isNull(Null) is not true?")
Call ok(isNumeric(Empty), "isNumeric(empty) is not true?")
Call ok(not isNumeric(Null), "isNumeric(Null) is not true?")
Call ok(isNumeric(32767), "isNumeric(32767) is true?")
Call ok(isNumeric(32768), "isNumeric(32768) is true?")
Call ok(isNumeric(CSng(3242.4)), "isNumeric(CSng(3242.4)) is true?")
Call ok(isNumeric(32768.4), "isNumeric(32768.4) is true?")
Call ok(isNumeric(CCur(32768.4)), "isNumeric(CCur(32768.4)) is true?")
Call ok(isNumeric("44"), "isNumeric(""44"") is true?")
Call ok(not isNumeric("rwrf"), "isNumeric(""rwrf"") is not true?")
Call ok(not isNumeric(Nothing), "isNumeric(Nothing) is not true?")
Call ok(not isNumeric(New EmptyClass), "isNumeric(New EmptyClass) is not true?")
Call ok(isNumeric(true), "isNumeric(true) is true?")
Call ok(isNumeric(CByte(32)), "isNumeric(CByte(32)) is true?")
Dim arr(2)
arr(0) = 2
arr(1) = 3
Call ok(not isNumeric(arr), "isNumeric(arr) is not true?")
Dim newObject
Set newObject = New ValClass
newObject.myval = 1
Call ok(isNumeric(newObject), "isNumeric(newObject) is true?")
newObject.myval = "test"
Call ok(not isNumeric(newObject), "isNumeric(newObject) is not true?")
Call ok(getVT(err) = "VT_DISPATCH", "getVT(err) = " & getVT(err))
Sub TestHex(x, ex)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment