Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
997820f7
Commit
997820f7
authored
Jul 15, 2014
by
Shuai Meng
Committed by
Alexandre Julliard
Jul 16, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Implemented Abs.
parent
30437f9f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
2 deletions
+56
-2
global.c
dlls/vbscript/global.c
+17
-2
api.vbs
dlls/vbscript/tests/api.vbs
+39
-0
No files found.
dlls/vbscript/global.c
View file @
997820f7
...
...
@@ -1246,8 +1246,23 @@ static HRESULT Global_ChrW(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI
static
HRESULT
Global_Abs
(
vbdisp_t
*
This
,
VARIANT
*
arg
,
unsigned
args_cnt
,
VARIANT
*
res
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
HRESULT
hres
;
VARIANT
dst
;
TRACE
(
"(%s)
\n
"
,
debugstr_variant
(
arg
));
assert
(
args_cnt
==
1
);
hres
=
VarAbs
(
arg
,
&
dst
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
res
)
*
res
=
dst
;
else
VariantClear
(
&
dst
);
return
S_OK
;
}
static
HRESULT
Global_Fix
(
vbdisp_t
*
This
,
VARIANT
*
arg
,
unsigned
args_cnt
,
VARIANT
*
res
)
...
...
dlls/vbscript/tests/api.vbs
View file @
997820f7
...
...
@@ -909,4 +909,43 @@ End Sub
Call
testSgnError
(
Null
,
94
)
Call
ok
(
Abs
(
Empty
)
=
0
,
"Abs(Empty) = "
&
Abs
(
Empty
))
Call
ok
(
getVT
(
Abs
(
Empty
))
=
"VT_I2"
,
"getVT(Abs(Empty)) = "
&
getVT
(
Abs
(
Empty
)))
Call
ok
(
IsNull
(
Abs
(
Null
)),
"Is Abs(Null) not Null?"
)
Call
ok
(
getVT
(
Abs
(
Null
))
=
"VT_NULL"
,
"getVT(Abs(Null)) = "
&
getVT
(
Abs
(
Null
)))
Call
ok
(
Abs
(
0
)
=
0
,
"Abs(0) = "
&
Abs
(
0
))
Call
ok
(
getVT
(
Abs
(
0
))
=
"VT_I2"
,
"getVT(Abs(0)) = "
&
getVT
(
Abs
(
0
)))
Call
ok
(
Abs
(
-
32769
)
=
32769
,
"Abs(-32769) = "
&
Abs
(
-
32769
))
Call
ok
(
getVT
(
Abs
(
-
32769
))
=
"VT_I4"
,
"getVT(Abs(-32769)) = "
&
getVT
(
Abs
(
-
32769
)))
Call
ok
(
Abs
(
CSng
(
-
0.5
))
=
0.5
,
"Abs(CSng(-0.5)) = "
&
Abs
(
CSng
(
-
0.5
)))
Call
ok
(
getVT
(
Abs
(
CSng
(
-
0.5
)))
=
"VT_R4"
,
"getVT(Abs(CSng(-0.5))) = "
&
getVT
(
Abs
(
CSng
(
-
0.5
))))
Call
ok
(
Abs
(
0.5
)
=
0.5
,
"Abs(0.5) = "
&
Abs
(
0.5
))
Call
ok
(
getVT
(
Abs
(
0.5
))
=
"VT_R8"
,
"getVT(Abs(0.5)) = "
&
getVT
(
Abs
(
0.5
)))
Call
ok
(
Abs
(
CCur
(
-
1
))
=
1
,
"Abs(CCur(-1)) = "
&
Abs
(
CCur
(
-
1
)))
Call
ok
(
getVT
(
Abs
(
CCur
(
-
1
)))
=
"VT_CY"
,
"getVT(Abs(CCur(-1))) = "
&
getVT
(
Abs
(
CCur
(
-
1
))))
Call
ok
(
Abs
(
"-1"
)
=
1
,
"Abs(
""
-1
""
) = "
&
Abs
(
"-1"
))
Call
ok
(
getVT
(
Abs
(
"-1"
))
=
"VT_R8"
,
"getVT(Abs(
""
-1
""
)) = "
&
getVT
(
Abs
(
"-1"
)))
Call
ok
(
Abs
(
False
)
=
0
,
"Abs(False) = "
&
Abs
(
False
))
Call
ok
(
getVT
(
Abs
(
False
))
=
"VT_I2"
,
"getVT(Abs(False)) = "
&
getVT
(
Abs
(
False
)))
Call
ok
(
Abs
(
True
)
=
1
,
"Abs(True) = "
&
Abs
(
True
))
Call
ok
(
getVT
(
Abs
(
True
))
=
"VT_I2"
,
"getVT(Abs(True)) = "
&
getVT
(
Abs
(
True
)))
Call
ok
(
Abs
(
CByte
(
1
))
=
1
,
"Abs(CByte(1)) = "
&
Abs
(
CByte
(
1
)))
Call
ok
(
getVT
(
Abs
(
CByte
(
1
)))
=
"VT_UI1"
,
"getVT(Abs(CByte(1))) = "
&
getVT
(
Abs
(
CByte
(
1
))))
Sub
testAbsError
(
strings
,
error_num1
,
error_num2
)
on
error
resume
next
Dim
x
Call
Err
.
clear
()
x
=
Abs
(
strings
)
Call
ok
(
Err
.
number
=
error_num1
,
"Err.number1 = "
&
Err
.
number
)
Call
Err
.
clear
()
Call
Abs
(
strings
)
Call
ok
(
Err
.
number
=
error_num2
,
"Err.number2 = "
&
Err
.
number
)
End
Sub
Call
testAbsError
(
"strings"
,
13
,
13
)
Call
testAbsError
(
-
4
,
0
,
0
)
Call
reportSuccess
()
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