Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
d8135b82
Commit
d8135b82
authored
Jun 13, 2014
by
Shuai Meng
Committed by
Alexandre Julliard
Jun 16, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Implemented CSng.
parent
05f65a93
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
2 deletions
+67
-2
global.c
dlls/vbscript/global.c
+17
-2
api.vbs
dlls/vbscript/tests/api.vbs
+48
-0
run.c
dlls/vbscript/tests/run.c
+2
-0
No files found.
dlls/vbscript/global.c
View file @
d8135b82
...
...
@@ -514,8 +514,23 @@ static HRESULT Global_CDbl(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI
static
HRESULT
Global_CSng
(
vbdisp_t
*
This
,
VARIANT
*
arg
,
unsigned
args_cnt
,
VARIANT
*
res
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
VARIANT
v
;
HRESULT
hres
;
TRACE
(
"%s
\n
"
,
debugstr_variant
(
arg
));
assert
(
args_cnt
==
1
);
V_VT
(
&
v
)
=
VT_EMPTY
;
hres
=
VariantChangeType
(
&
v
,
arg
,
0
,
VT_R4
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
!
res
)
return
DISP_E_BADVARTYPE
;
*
res
=
v
;
return
S_OK
;
}
static
HRESULT
Global_CStr
(
vbdisp_t
*
This
,
VARIANT
*
arg
,
unsigned
args_cnt
,
VARIANT
*
res
)
...
...
dlls/vbscript/tests/api.vbs
View file @
d8135b82
...
...
@@ -797,4 +797,52 @@ MyObject.myval = 1.5
Call
ok
(
CInt
(
MyObject
)
=
2
,
"CInt(MyObject) = "
&
CInt
(
MyObject
))
Call
ok
(
getVT
(
CInt
(
MyObject
))
=
"VT_I2"
,
"getVT(CInt(MyObject)) = "
&
getVT
(
CInt
(
MyObject
)))
Sub
testCSngError
(
strings
,
error_num1
,
error_num2
)
on
error
resume
next
Dim
x
Call
Err
.
clear
()
x
=
CSng
(
strings
)
Call
ok
(
Err
.
number
=
error_num1
,
"Err.number = "
&
Err
.
number
)
Call
Err
.
clear
()
Call
CSng
(
strings
)
Call
ok
(
Err
.
number
=
error_num2
,
"Err.number = "
&
Err
.
number
)
End
Sub
Call
ok
(
CSng
(
Empty
)
=
0
,
"CSng(Empty) = "
&
CSng
(
Empty
))
Call
ok
(
getVT
(
CSng
(
Empty
))
=
"VT_R4"
,
"getVT(CSng(Empty)) = "
&
getVT
(
CSng
(
Empty
)))
Call
ok
(
CSng
(
CByte
(
0
))
=
0
,
"CSng(CByte(0)) = "
&
CSng
(
CByte
(
0
)))
Call
ok
(
getVT
(
CSng
(
CCur
(
0
)))
=
"VT_R4"
,
"getVT(CSng(CCur(0))) = "
&
getVT
(
CSng
(
CCur
(
0
))))
Call
ok
(
CSng
(
CCur
(
0
))
=
0
,
"CSng(CCur(0)) = "
&
CSng
(
CCur
(
0
)))
Call
ok
(
getVT
(
CSng
(
CCur
(
0
)))
=
"VT_R4"
,
"getVT(CSng(CCur(0))) = "
&
getVT
(
CSng
(
CCur
(
0
))))
Call
ok
(
CSng
(
0
)
=
0
,
"CSng(0) = "
&
CSng
(
0
))
Call
ok
(
getVT
(
CSng
(
0
))
=
"VT_R4"
,
"getVT(CSng(0)) = "
&
getVT
(
CSng
(
0
)))
Call
ok
(
CSng
(
32768
)
=
32768
,
"CSng(32768) = "
&
CSng
(
32768
))
Call
ok
(
getVT
(
CSng
(
32768
))
=
"VT_R4"
,
"getVT(CSng(32768)) = "
&
getVT
(
CSng
(
32768
)))
Call
ok
(
CSng
(
0.001
*
0.001
)
=
0.000001
,
"CSng(0.001 * 0.001) = "
&
CSng
(
0.001
*
0.001
))
Call
ok
(
getVT
(
CSng
(
0.001
*
0.001
))
=
"VT_R4"
,
"getVT(CSng(0.001 * 0.001)) = "
&
getVT
(
CSng
(
0.001
*
0.001
)))
Call
ok
(
CSng
(
"-1"
)
=
-
1
,
"CSng(
""
-1
""
) = "
&
CSng
(
"-1"
))
Call
ok
(
getVT
(
CSng
(
"-1"
))
=
"VT_R4"
,
"getVT(CSng(
""
-1
""
)) = "
&
getVT
(
CSng
(
"-1"
)))
If
isEnglishLang
Then
Call
ok
(
CSng
(
"-0.5"
)
=
-
0.5
,
"CSng(
""
-0.5
""
) = "
&
CSng
(
"-0.5"
))
Call
ok
(
getVT
(
CSng
(
"-0.5"
))
=
"VT_R4"
,
"getVT(CSng(
""
-0.5
""
)) = "
&
getVT
(
CSng
(
"-0.5"
)))
End
If
Call
testCSngError
(
""
,
13
,
13
)
Call
testCSngError
(
"TRUE"
,
13
,
13
)
Call
testCSngError
(
"FALSE"
,
13
,
13
)
Call
testCSngError
(
"#TRue#"
,
13
,
13
)
Call
testCSngError
(
"#fAlSE#"
,
13
,
13
)
Call
testCSngError
(
1
,
0
,
458
)
Call
ok
(
CSng
(
True
)
=
-
1
,
"CSng(True) = "
&
CSng
(
True
))
Call
ok
(
getVT
(
CSng
(
True
))
=
"VT_R4"
,
"getVT(CSng(True)) = "
&
getVT
(
CSng
(
True
)))
Call
ok
(
CSng
(
False
)
=
0
,
"CSng(False) = "
&
CSng
(
False
))
Call
ok
(
getVT
(
CSng
(
False
))
=
"VT_R4"
,
"getVT(CSng(False)) = "
&
getVT
(
CSng
(
False
)))
MyObject
.
myval
=
0.1
Call
ok
(
CSng
(
MyObject
)
=
0.1
,
"CSng(MyObject) = "
&
CSng
(
MyObject
))
Call
ok
(
getVT
(
CSng
(
MyObject
))
=
"VT_R4"
,
"getVT(CSng(MyObject)) = "
&
getVT
(
CSng
(
MyObject
)))
MyObject
.
myval
=
0
Call
ok
(
CSng
(
MyObject
)
=
0
,
"CSng(MyObject) = "
&
CSng
(
MyObject
))
Call
ok
(
getVT
(
CSng
(
MyObject
))
=
"VT_R4"
,
"getVT(CSng(MyObject)) = "
&
getVT
(
CSng
(
MyObject
)))
Call
reportSuccess
()
dlls/vbscript/tests/run.c
View file @
d8135b82
...
...
@@ -167,6 +167,8 @@ static const char *vt2a(VARIANT *v)
return
"VT_I2"
;
case
VT_I4
:
return
"VT_I4"
;
case
VT_R4
:
return
"VT_R4"
;
case
VT_R8
:
return
"VT_R8"
;
case
VT_CY
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment