You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
820 lines
27 KiB
820 lines
27 KiB
<!--
|
|
******************************************************************
|
|
'
|
|
' addvalues.wsf
|
|
'
|
|
' Purpose: test SWbemPropertyEx::AddValues
|
|
'
|
|
' Parameters: none
|
|
'
|
|
' Returns: 0 - success
|
|
' 1 - failure
|
|
'
|
|
'*****************************************************************
|
|
-->
|
|
|
|
<job id="WMI AddValues Test">
|
|
<reference object="WbemScripting.SWbemLocator" version="1.2"/>
|
|
<script language="VBScript">
|
|
|
|
on error resume next
|
|
|
|
set scriptHelper = CreateObject("WMIScriptHelper.WSC")
|
|
scriptHelper.logFile = "c:\temp\addvalues.txt"
|
|
scriptHelper.loggingLevel = 3
|
|
scriptHelper.testName = "WMI AddValues"
|
|
scriptHelper.testStart
|
|
|
|
dim ns
|
|
dim newClass
|
|
|
|
' Connect to the namespace
|
|
set ns = GetObject("winmgmts:root\default")
|
|
|
|
if err <> 0 then
|
|
scriptHelper.writeErrorToLog err, "Failed to connect to root\default"
|
|
else
|
|
scriptHelper.writeToLog "Successful connection to root\default", 2
|
|
end if
|
|
|
|
'Make a new class
|
|
set newClass = ns.Get
|
|
|
|
if err <> 0 then
|
|
scriptHelper.writeErrorToLog err, "Failed to get empty class"
|
|
else
|
|
scriptHelper.writeToLog "Successful retrieval of empty class", 2
|
|
end if
|
|
|
|
newClass.Path_.Class = "ADDVALUES000TEST"
|
|
|
|
' Add a non-array property (uint32)
|
|
set p0 = newClass.Properties_.Add ("p0", 19)
|
|
p0 = 251
|
|
|
|
' Add some array properties, one for each type
|
|
set p = newClass.Properties_.Add ("pSint8", wbemCimtypeSint8, true)
|
|
p.Value = Array (-1, 0, 1, 2)
|
|
newClass.Properties_.Add "pUint8", wbemCimtypeUint8, true
|
|
newClass.Properties_.Add "pSint16", wbemCimtypeSint16, true
|
|
newClass.Properties_.Add "pUint16", wbemCimtypeUint16, true
|
|
newClass.Properties_.Add "pSint32", wbemCimtypeSint32, true
|
|
newClass.Properties_.Add "pUint32", wbemCimtypeUint32, true
|
|
newClass.Properties_.Add "pSint64", wbemCimtypeSint64, true
|
|
newClass.Properties_.Add "pUint64", wbemCimtypeUint64, true
|
|
newClass.Properties_.Add "pReal32", wbemCimtypeReal32, true
|
|
newClass.Properties_.Add "pReal64", wbemCimtypeReal64, true
|
|
newClass.Properties_.Add "pBoolean", wbemCimtypeBoolean, true
|
|
set p = newClass.Properties_.Add ("pString", wbemCimtypeString, true)
|
|
p.Value = Array ("I", "have", "but")
|
|
newClass.Properties_.Add "pDatetime", wbemCimtypeDatetime, true
|
|
newClass.Properties_.Add "pReference", wbemCimtypeReference, true
|
|
newClass.Properties_.Add "pChar16", wbemCimtypeChar16, true
|
|
newClass.Properties_.Add "pObject", wbemCimtypeObject, true
|
|
|
|
if err <> 0 then
|
|
scriptHelper.writeErrorToLog err, "Failed to define class"
|
|
else
|
|
scriptHelper.writeToLog "Successful definition of class", 2
|
|
end if
|
|
|
|
' Save the class
|
|
newClass.Put_
|
|
|
|
if err <> 0 then
|
|
scriptHelper.writeErrorToLog err, "Failed to save class"
|
|
else
|
|
scriptHelper.writeToLog "Successful save of class", 2
|
|
end if
|
|
|
|
' Get it back
|
|
set newClass = ns.Get ("ADDVALUES000TEST")
|
|
|
|
if err <> 0 then
|
|
scriptHelper.writeErrorToLog err, "Failed to get class"
|
|
else
|
|
scriptHelper.writeToLog "Successful get of class", 2
|
|
end if
|
|
|
|
' now test each property type
|
|
TestUint8
|
|
TestSint8
|
|
TestUint16
|
|
TestSint16
|
|
TestUint32
|
|
TestSint32
|
|
TestUint64
|
|
TestSint64
|
|
TestReal32
|
|
TestReal64
|
|
TestBoolean
|
|
TestString
|
|
TestDatetime
|
|
TestReference
|
|
TestChar16
|
|
TestObject
|
|
|
|
' Save the class
|
|
newClass.Put_
|
|
|
|
if err <> 0 then
|
|
scriptHelper.writeErrorToLog err, "Failed to save class"
|
|
else
|
|
scriptHelper.writeToLog "Successful save of class", 2
|
|
end if
|
|
|
|
' Clean up
|
|
newClass.Delete_
|
|
|
|
if err <> 0 then
|
|
scriptHelper.writeErrorToLog err, "Failed to delete class"
|
|
else
|
|
scriptHelper.writeToLog "Successful delete of class", 2
|
|
end if
|
|
|
|
scriptHelper.testComplete
|
|
|
|
if scriptHelper.statusOK then
|
|
WScript.Echo "PASS"
|
|
WScript.Quit 0
|
|
else
|
|
WScript.Echo "FAIL"
|
|
WScript.Quit 1
|
|
end if
|
|
|
|
'****************************************************************
|
|
'*
|
|
'* TestUint8
|
|
'* =========
|
|
'*
|
|
'* Test AddValues for uint8 arrays
|
|
'*
|
|
'****************************************************************
|
|
|
|
Sub TestUint8
|
|
|
|
on error resume next
|
|
' Try an add of a simple value
|
|
set pUint8 = newClass.Properties_("pUint8")
|
|
pUint8.AddValues 1
|
|
scriptHelper.scriptHelper.DisplayValue newClass, newClass, "pUint8"
|
|
scriptHelper.VerifyValue pUint8.Value, Array (1)
|
|
|
|
' Try an add of a simple value
|
|
pUint8.AddValues 2
|
|
scriptHelper.scriptHelper.DisplayValue newClass, newClass, "pUint8"
|
|
scriptHelper.VerifyValue pUint8.Value, Array (1,2)
|
|
|
|
' Try an add of a complex value
|
|
pUint8.AddValues Array (3, 4, 5)
|
|
scriptHelper.DisplayValue newClass, "pUint8"
|
|
scriptHelper.VerifyValue pUint8.Value, Array (1, 2, 3, 4, 5)
|
|
|
|
' Try an insert of a simple value
|
|
pUint8.AddValues 0, wbemAddValuesInsert
|
|
scriptHelper.DisplayValue newClass, "pUint8"
|
|
scriptHelper.scriptHelper.VerifyValue pUint8.Value, Array (0, 1, 2, 3, 4, 5)
|
|
|
|
' Try an insert of a complex value
|
|
pUint8.AddValues Array (12, 13, 14), wbemAddValuesInsert
|
|
scriptHelper.DisplayValue newClass, "pUint8"
|
|
scriptHelper.VerifyValue pUint8.Value, Array (12, 13, 14, 0, 1, 2, 3, 4, 5)
|
|
|
|
' Try an insert of a simple value
|
|
pUint8.AddValues 100, wbemAddValuesInsert, -1
|
|
scriptHelper.DisplayValue newClass, "pUint8"
|
|
scriptHelper.VerifyValue pUint8.Value, Array (12, 13, 14, 0, 1, 2, 3, 4, 5, 100)
|
|
|
|
' Try an insert of a simple value
|
|
pUint8.AddValues 101, wbemAddValuesInsert, 10
|
|
scriptHelper.DisplayValue newClass, "pUint8"
|
|
scriptHelper.VerifyValue pUint8.Value, Array (12, 13, 14, 0, 1, 2, 3, 4, 5, 100, 101)
|
|
|
|
' Try an insert of a complex value
|
|
pUint8.AddValues Array (112, 113, 114), wbemAddValuesInsert, 3
|
|
scriptHelper.DisplayValue newClass, "pUint8"
|
|
scriptHelper.VerifyValue pUint8.Value, Array (12, 13, 14, 112, 113, 114, 0, 1, 2, 3, 4, 5, 100, 101)
|
|
|
|
' Try an insert of a complex value
|
|
pUint8.AddValues Array (32, 33, 34), wbemAddValuesInsert, -1
|
|
scriptHelper.DisplayValue newClass, "pUint8"
|
|
scriptHelper.VerifyValue pUint8.Value, Array (12, 13, 14, 112, 113, 114, 0, 1, 2, 3, 4, 5, 100, 101, 32, 33, 34)
|
|
|
|
End Sub
|
|
|
|
'****************************************************************
|
|
'*
|
|
'* TestSint8
|
|
'* =========
|
|
'*
|
|
'* Test AddValues for sint8 arrays
|
|
'*
|
|
'****************************************************************
|
|
|
|
Sub TestSint8
|
|
|
|
on error resume next
|
|
' Try an add of a simple value
|
|
set pSint8 = newClass.Properties_("pSint8")
|
|
pSint8.AddValues 3
|
|
scriptHelper.DisplayValue newClass, "pSint8"
|
|
scriptHelper.VerifyValue pSint8.Value, Array (-1, 0, 1, 2, 3)
|
|
|
|
' Try an add of a simple value
|
|
pSint8.AddValues 4
|
|
scriptHelper.DisplayValue newClass, "pSint8"
|
|
scriptHelper.VerifyValue pSint8.Value, Array (-1, 0, 1, 2, 3, 4)
|
|
|
|
' Try an add of a complex value
|
|
pSint8.AddValues Array (5, 6, 7, 8)
|
|
scriptHelper.DisplayValue newClass, "pSint8"
|
|
scriptHelper.VerifyValue pSint8.Value, Array (-1, 0, 1, 2, 3, 4, 5, 6, 7, 8)
|
|
|
|
' Try an insert of a simple value
|
|
pSint8.AddValues 101, wbemAddValuesInsert, 10
|
|
scriptHelper.DisplayValue newClass, "pSint8"
|
|
scriptHelper.VerifyValue pSint8.Value, Array (-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 101)
|
|
|
|
' Try an insert of a complex value
|
|
pSint8.AddValues Array (-112, 113, -114), wbemAddValuesInsert, 3
|
|
scriptHelper.DisplayValue newClass, "pSint8"
|
|
scriptHelper.VerifyValue pSint8.Value, Array (-1, 0, 1, -112, 113, -114, 2, 3, 4, 5, 6, 7, 8, 101)
|
|
|
|
End Sub
|
|
|
|
'****************************************************************
|
|
'*
|
|
'* TestString
|
|
'* ============
|
|
'*
|
|
'* Test AddValues for string arrays
|
|
'*
|
|
'****************************************************************
|
|
|
|
Sub TestString
|
|
|
|
on error resume next
|
|
' Try an add of a simple value
|
|
set pString = newClass.Properties_("pString")
|
|
pString.AddValues "an"
|
|
scriptHelper.DisplayValue newClass, "pString"
|
|
scriptHelper.VerifyValue pString.Value, Array ("I", "have", "but", "an")
|
|
|
|
' Try an add of a simple value
|
|
pString.AddValues "hour"
|
|
scriptHelper.DisplayValue newClass, "pString"
|
|
scriptHelper.VerifyValue pString.Value, Array ("I", "have", "but", "an", "hour")
|
|
|
|
' Try an add of a complex value
|
|
pString.AddValues Array ("Obey", "the", "time")
|
|
scriptHelper.DisplayValue newClass, "pString"
|
|
scriptHelper.VerifyValue pString.Value, Array ("I", "have", "but", "an", "hour", "Obey", "the", "time")
|
|
|
|
' Try an insert of a simple value
|
|
pString.AddValues "Bill", wbemAddValuesInsert, 5
|
|
scriptHelper.DisplayValue newClass, "pString"
|
|
scriptHelper.VerifyValue pString.Value, Array ("I", "have", "but", "an", "hour", "Bill", "Obey", "the", "time")
|
|
|
|
' Try an insert of a complex value
|
|
pString.AddValues Array ("the", "Shake"), wbemAddValuesInsert, 6
|
|
scriptHelper.DisplayValue newClass, "pString"
|
|
scriptHelper.VerifyValue pString.Value, Array ("I", "have", "but", "an", "hour", "Bill", "the", "Shake", "Obey", "the", "time")
|
|
End Sub
|
|
|
|
'****************************************************************
|
|
'*
|
|
'* TestUint16
|
|
'* ==========
|
|
'*
|
|
'* Test AddValues for uint16 arrays
|
|
'*
|
|
'****************************************************************
|
|
|
|
Sub TestUint16
|
|
|
|
on error resume next
|
|
' Try an add of a simple value
|
|
set pUint16 = newClass.Properties_("pUint16")
|
|
pUint16.AddValues 0
|
|
scriptHelper.DisplayValue newClass, "pUint16"
|
|
scriptHelper.VerifyValue pUint16.Value, Array (0)
|
|
|
|
' Try an add of a simple value
|
|
pUint16.AddValues 255
|
|
scriptHelper.DisplayValue newClass, "pUint16"
|
|
scriptHelper.VerifyValue pUint16.Value, Array (0,255)
|
|
|
|
' Try an add of a complex value
|
|
pUint16.AddValues Array (256, 65534)
|
|
scriptHelper.DisplayValue newClass, "pUint16"
|
|
scriptHelper.VerifyValue pUint16.Value, Array (0, 255, 256, 65534)
|
|
|
|
' Try an insert of a simple value
|
|
pUint16.AddValues 123, wbemAddValuesInsert, 1
|
|
scriptHelper.DisplayValue newClass, "pUint16"
|
|
scriptHelper.VerifyValue pUint16.Value, Array (0, 123, 255, 256, 65534)
|
|
|
|
' Try an insert of a complex value
|
|
pUint16.AddValues Array (10, 12), wbemAddValuesInsert, 4
|
|
scriptHelper.DisplayValue newClass, "pUint16"
|
|
scriptHelper.VerifyValue pUint16.Value, Array (0, 123, 255, 256, 10, 12, 65534)
|
|
|
|
End Sub
|
|
|
|
'****************************************************************
|
|
'*
|
|
'* TestSint16
|
|
'* ==========
|
|
'*
|
|
'* Test AddValues for sint16 arrays
|
|
'*
|
|
'****************************************************************
|
|
|
|
Sub TestSint16
|
|
|
|
on error resume next
|
|
' Try an add of a simple value
|
|
set pSint16 = newClass.Properties_("pSint16")
|
|
pSint16.AddValues -254
|
|
scriptHelper.DisplayValue newClass, "pSint16"
|
|
scriptHelper.VerifyValue pSint16.Value, Array (-254)
|
|
|
|
' Try an add of a simple value
|
|
pSint16.AddValues -1
|
|
scriptHelper.DisplayValue newClass, "pSint16"
|
|
scriptHelper.VerifyValue pSint16.Value, Array (-254, -1)
|
|
|
|
' Try an add of a complex value
|
|
pSint16.AddValues Array (0, 1, 255)
|
|
scriptHelper.DisplayValue newClass, "pSint16"
|
|
scriptHelper.VerifyValue pSint16.Value, Array (-254, -1, 0, 1, 255)
|
|
|
|
' Try an insert of a simple value
|
|
pSint16.AddValues 123, wbemAddValuesInsert, 1
|
|
scriptHelper.DisplayValue newClass, "pSint16"
|
|
scriptHelper.VerifyValue pSint16.Value, Array (-254, 123, -1, 0, 1, 255)
|
|
|
|
' Try an insert of a complex value
|
|
pSint16.AddValues Array (10, 12), wbemAddValuesInsert, 4
|
|
scriptHelper.DisplayValue newClass, "pSint16"
|
|
scriptHelper.VerifyValue pSint16.Value, Array (-254, 123, -1, 0, 10, 12, 1, 255)
|
|
|
|
End Sub
|
|
|
|
'****************************************************************
|
|
'*
|
|
'* TestUint32
|
|
'* ==========
|
|
'*
|
|
'* Test AddValues for uint32 arrays
|
|
'*
|
|
'****************************************************************
|
|
|
|
Sub TestUint32
|
|
|
|
on error resume next
|
|
' Try an add of a simple value
|
|
set pUint32 = newClass.Properties_("pUint32")
|
|
pUint32.AddValues 0
|
|
scriptHelper.DisplayValue newClass, "pUint32"
|
|
scriptHelper.VerifyValue pUint32.Value, Array (0)
|
|
|
|
' Try an add of a simple value
|
|
pUint32.AddValues 65535
|
|
scriptHelper.DisplayValue newClass, "pUint32"
|
|
scriptHelper.VerifyValue pUint32.Value, Array (0,65535)
|
|
|
|
' Try an add of a complex value
|
|
pUint32.AddValues Array (256, 65534)
|
|
scriptHelper.DisplayValue newClass, "pUint32"
|
|
scriptHelper.VerifyValue pUint32.Value, Array (0, 65535, 256, 65534)
|
|
|
|
' Try an insert of a simple value
|
|
pUint32.AddValues 123, wbemAddValuesInsert, 1
|
|
scriptHelper.DisplayValue newClass, "pUint32"
|
|
scriptHelper.VerifyValue pUint32.Value, Array (0, 123, 65535, 256, 65534)
|
|
|
|
' Try an insert of a complex value
|
|
pUint32.AddValues Array (10, 12), wbemAddValuesInsert, 4
|
|
scriptHelper.DisplayValue newClass, "pUint32"
|
|
scriptHelper.VerifyValue pUint32.Value, Array (0, 123, 65535, 256, 10, 12, 65534)
|
|
|
|
End Sub
|
|
|
|
'****************************************************************
|
|
'*
|
|
'* TestSint32
|
|
'* ==========
|
|
'*
|
|
'* Test AddValues for sint32 arrays
|
|
'*
|
|
'****************************************************************
|
|
|
|
Sub TestSint32
|
|
|
|
on error resume next
|
|
' Try an add of a simple value
|
|
set pSint32 = newClass.Properties_("pSint32")
|
|
pSint32.AddValues -65534
|
|
scriptHelper.DisplayValue newClass, "pSint32"
|
|
scriptHelper.VerifyValue pSint32.Value, Array (-65534)
|
|
|
|
' Try an add of a simple value
|
|
pSint32.AddValues -1
|
|
scriptHelper.DisplayValue newClass, "pSint32"
|
|
scriptHelper.VerifyValue pSint32.Value, Array (-65534, -1)
|
|
|
|
' Try an add of a complex value
|
|
pSint32.AddValues Array (0, 1, 65535)
|
|
scriptHelper.DisplayValue newClass, "pSint32"
|
|
scriptHelper.VerifyValue pSint32.Value, Array (-65534, -1, 0, 1, 65535)
|
|
|
|
' Try an insert of a simple value
|
|
pSint32.AddValues 123, wbemAddValuesInsert, 1
|
|
scriptHelper.DisplayValue newClass, "pSint32"
|
|
scriptHelper.VerifyValue pSint32.Value, Array (-65534, 123, -1, 0, 1, 65535)
|
|
|
|
' Try an insert of a complex value
|
|
pSint32.AddValues Array (10, 12), wbemAddValuesInsert, 4
|
|
scriptHelper.DisplayValue newClass, "pSint32"
|
|
scriptHelper.VerifyValue pSint32.Value, Array (-65534, 123, -1, 0, 10, 12, 1, 65535)
|
|
|
|
End Sub
|
|
|
|
'****************************************************************
|
|
'*
|
|
'* TestUint64
|
|
'* ==========
|
|
'*
|
|
'* Test AddValues for uint64 arrays
|
|
'*
|
|
'****************************************************************
|
|
|
|
Sub TestUint64
|
|
|
|
on error resume next
|
|
' Try an add of a simple value
|
|
set pUint64 = newClass.Properties_("pUint64")
|
|
pUint64.AddValues "0"
|
|
scriptHelper.DisplayValue newClass, "pUint64"
|
|
scriptHelper.VerifyValue pUint64.Value, Array ("0")
|
|
|
|
' Try an add of a simple value
|
|
pUint64.AddValues "6553565535"
|
|
scriptHelper.DisplayValue newClass, "pUint64"
|
|
scriptHelper.VerifyValue pUint64.Value, Array ("0","6553565535")
|
|
|
|
' Try an add of a complex value
|
|
pUint64.AddValues Array ("256", "65534")
|
|
scriptHelper.DisplayValue newClass, "pUint64"
|
|
scriptHelper.VerifyValue pUint64.Value, Array ("0", "6553565535", "256", "65534")
|
|
|
|
' Try an insert of a simple value
|
|
pUint64.AddValues "123", wbemAddValuesInsert, 1
|
|
scriptHelper.DisplayValue newClass, "pUint64"
|
|
scriptHelper.VerifyValue pUint64.Value, Array ("0", "123", "6553565535", "256", "65534")
|
|
|
|
' Try an insert of a complex value
|
|
pUint64.AddValues Array ("10", "12"), wbemAddValuesInsert, 4
|
|
scriptHelper.DisplayValue newClass, "pUint64"
|
|
scriptHelper.VerifyValue pUint64.Value, Array ("0", "123", "6553565535", "256", "10", "12", "65534")
|
|
|
|
End Sub
|
|
|
|
'****************************************************************
|
|
'*
|
|
'* TestSint64
|
|
'* ==========
|
|
'*
|
|
'* Test AddValues for sint64 arrays
|
|
'*
|
|
'****************************************************************
|
|
|
|
Sub TestSint64
|
|
|
|
on error resume next
|
|
' Try an add of a simple value
|
|
set pSint64 = newClass.Properties_("pSint64")
|
|
pSint64.AddValues "0"
|
|
scriptHelper.DisplayValue newClass, "pSint64"
|
|
scriptHelper.VerifyValue pSint64.Value, Array ("0")
|
|
|
|
' Try an add of a simple value
|
|
pSint64.AddValues "-6553565535"
|
|
scriptHelper.DisplayValue newClass, "pSint64"
|
|
scriptHelper.VerifyValue pSint64.Value, Array ("0","-6553565535")
|
|
|
|
' Try an add of a complex value
|
|
pSint64.AddValues Array ("256", "6553465534")
|
|
scriptHelper.DisplayValue newClass, "pSint64"
|
|
scriptHelper.VerifyValue pSint64.Value, Array ("0", "-6553565535", "256", "6553465534")
|
|
|
|
' Try an insert of a simple value
|
|
pSint64.AddValues "123", wbemAddValuesInsert, 1
|
|
scriptHelper.DisplayValue newClass, "pSint64"
|
|
scriptHelper.VerifyValue pSint64.Value, Array ("0", "123", "-6553565535", "256", "6553465534")
|
|
|
|
' Try an insert of a complex value
|
|
pSint64.AddValues Array ("10", "12"), wbemAddValuesInsert, 4
|
|
scriptHelper.DisplayValue newClass, "pSint64"
|
|
scriptHelper.VerifyValue pSint64.Value, Array ("0", "123", "-6553565535", "256", "10", "12", "6553465534")
|
|
|
|
End Sub
|
|
|
|
'****************************************************************
|
|
'*
|
|
'* TestReal32
|
|
'* ==========
|
|
'*
|
|
'* Test AddValues for real32 arrays
|
|
'*
|
|
'****************************************************************
|
|
|
|
Sub TestReal32
|
|
|
|
on error resume next
|
|
' Try an add of a simple value
|
|
set pReal32 = newClass.Properties_("pReal32")
|
|
pReal32.AddValues 0.0
|
|
scriptHelper.DisplayValue newClass, "pReal32"
|
|
scriptHelper.VerifyValue pReal32.Value, Array (0.0)
|
|
|
|
' Try an add of a simple value
|
|
pReal32.AddValues 65535.34
|
|
scriptHelper.DisplayValue newClass, "pReal32"
|
|
scriptHelper.VerifyValue pReal32.Value, Array (0.0,65535.34)
|
|
|
|
' Try an add of a complex value
|
|
pReal32.AddValues Array (-2.56, -65.534)
|
|
scriptHelper.DisplayValue newClass, "pReal32"
|
|
scriptHelper.VerifyValue pReal32.Value, Array (0.0, 65535.34, -2.56, -65.534)
|
|
|
|
' Try an insert of a simple value
|
|
pReal32.AddValues 1.23, wbemAddValuesInsert, 1
|
|
scriptHelper.DisplayValue newClass, "pReal32"
|
|
scriptHelper.VerifyValue pReal32.Value, Array (0.0, 1.23, 65535.34, -2.56, -65.534)
|
|
|
|
' Try an insert of a complex value
|
|
pReal32.AddValues Array (1.0, .12), wbemAddValuesInsert, 4
|
|
scriptHelper.DisplayValue newClass, "pReal32"
|
|
scriptHelper.VerifyValue pReal32.Value, Array (0.0, 1.23, 65535.34, -2.56, 1.0, .12, -65.534)
|
|
|
|
End Sub
|
|
|
|
'****************************************************************
|
|
'*
|
|
'* TestReal64
|
|
'* ==========
|
|
'*
|
|
'* Test AddValues for real64 arrays
|
|
'*
|
|
'****************************************************************
|
|
|
|
Sub TestReal64
|
|
|
|
on error resume next
|
|
' Try an add of a simple value
|
|
set pReal64 = newClass.Properties_("pReal64")
|
|
pReal64.AddValues 0.0
|
|
scriptHelper.DisplayValue newClass, "pReal64"
|
|
scriptHelper.VerifyValue pReal64.Value, Array (0.0)
|
|
|
|
' Try an add of a simple value
|
|
pReal64.AddValues 65535.343434
|
|
scriptHelper.DisplayValue newClass, "pReal64"
|
|
scriptHelper.VerifyValue pReal64.Value, Array (0.0,65535.343434)
|
|
|
|
' Try an add of a complex value
|
|
pReal64.AddValues Array (-2.56, -65.534534)
|
|
scriptHelper.DisplayValue newClass, "pReal64"
|
|
scriptHelper.VerifyValue pReal64.Value, Array (0.0, 65535.343434, -2.56, -65.534534)
|
|
|
|
' Try an insert of a simple value
|
|
pReal64.AddValues 1.23, wbemAddValuesInsert, 1
|
|
scriptHelper.DisplayValue newClass, "pReal64"
|
|
scriptHelper.VerifyValue pReal64.Value, Array (0.0, 1.23, 65535.343434, -2.56, -65.534534)
|
|
|
|
' Try an insert of a complex value
|
|
pReal64.AddValues Array (1.0, .12), wbemAddValuesInsert, 4
|
|
scriptHelper.DisplayValue newClass, "pReal64"
|
|
scriptHelper.VerifyValue pReal64.Value, Array (0.0, 1.23, 65535.343434, -2.56, 1.0, .12, -65.534534)
|
|
|
|
End Sub
|
|
|
|
'****************************************************************
|
|
'*
|
|
'* TestBoolean
|
|
'* ===========
|
|
'*
|
|
'* Test AddValues for boolean arrays
|
|
'*
|
|
'****************************************************************
|
|
|
|
Sub TestBoolean
|
|
|
|
on error resume next
|
|
' Try an add of a simple value
|
|
set pBoolean = newClass.Properties_("pBoolean")
|
|
pBoolean.AddValues true
|
|
scriptHelper.DisplayValue newClass, "pBoolean"
|
|
scriptHelper.VerifyValue pBoolean.Value, Array (true)
|
|
|
|
' Try an add of a simple value
|
|
pBoolean.AddValues false
|
|
scriptHelper.DisplayValue newClass, "pBoolean"
|
|
scriptHelper.VerifyValue pBoolean.Value, Array (true, false)
|
|
|
|
' Try an add of a complex value
|
|
pBoolean.AddValues Array (false, true, false, false, true, true)
|
|
scriptHelper.DisplayValue newClass, "pBoolean"
|
|
scriptHelper.VerifyValue pBoolean.Value, Array (true, false, false, true, false, false, true, true)
|
|
|
|
' Try an insert of a simple value
|
|
pBoolean.AddValues false, wbemAddValuesInsert, 1
|
|
scriptHelper.DisplayValue newClass, "pBoolean"
|
|
scriptHelper.VerifyValue pBoolean.Value, Array (true, false, false, false, true, false, false, true, true)
|
|
|
|
' Try an insert of a complex value
|
|
pBoolean.AddValues Array (true, false), wbemAddValuesInsert, 4
|
|
scriptHelper.DisplayValue newClass, "pBoolean"
|
|
scriptHelper.VerifyValue pBoolean.Value, Array (true, false, false, false, true, false, true, false, false, true, true)
|
|
|
|
End Sub
|
|
|
|
'****************************************************************
|
|
'*
|
|
'* TestDatetime
|
|
'* ============
|
|
'*
|
|
'* Test AddValues for datetime arrays
|
|
'*
|
|
'****************************************************************
|
|
|
|
Sub TestDatetime
|
|
|
|
on error resume next
|
|
' Try an add of a simple value
|
|
set pDatetime = newClass.Properties_("pDatetime")
|
|
pDatetime.AddValues "20000120195632.000000-480"
|
|
scriptHelper.DisplayValue newClass, "pDatetime"
|
|
scriptHelper.VerifyValue pDatetime.Value, Array ("20000120195632.000000-480")
|
|
|
|
' Try an add of a simple value
|
|
pDatetime.AddValues "20000120195632.000000+480"
|
|
scriptHelper.DisplayValue newClass, "pDatetime"
|
|
scriptHelper.VerifyValue pDatetime.Value, Array ("20000120195632.000000-480", "20000120195632.000000+480")
|
|
if err <> 0 then scriptHelper.writeErrorToLog err, "Bar"
|
|
|
|
' Try an add of a complex value
|
|
pDatetime.AddValues Array ("20000120195632.000000-480", "20000120195632.000000-480")
|
|
scriptHelper.DisplayValue newClass, "pDatetime"
|
|
scriptHelper.VerifyValue pDatetime.Value, Array ("20000120195632.000000-480", _
|
|
"20000120195632.000000+480", "20000120195632.000000-480", "20000120195632.000000-480")
|
|
|
|
' Try an insert of a simple value
|
|
pDatetime.AddValues "20000120195612.000000+480", wbemAddValuesInsert, 1
|
|
scriptHelper.DisplayValue newClass, "pDatetime"
|
|
scriptHelper.VerifyValue pDatetime.Value, Array ("20000120195632.000000-480", "20000120195612.000000+480", _
|
|
"20000120195632.000000+480", "20000120195632.000000-480", "20000120195632.000000-480")
|
|
|
|
' Try an insert of a complex value
|
|
pDatetime.AddValues Array ("20010120195612.000000+480", "20020120195612.000000+480"), wbemAddValuesInsert, 4
|
|
scriptHelper.DisplayValue newClass, "pDatetime"
|
|
scriptHelper.VerifyValue pDatetime.Value, Array ("20000120195632.000000-480", "20000120195612.000000+480", _
|
|
"20000120195632.000000+480", "20000120195632.000000-480", _
|
|
"20010120195612.000000+480", "20020120195612.000000+480", "20000120195632.000000-480")
|
|
|
|
End Sub
|
|
|
|
'****************************************************************
|
|
'*
|
|
'* TestReference
|
|
'* =============
|
|
'*
|
|
'* Test AddValues for reference arrays
|
|
'*
|
|
'****************************************************************
|
|
|
|
Sub TestReference
|
|
|
|
on error resume next
|
|
' Try an add of a simple value
|
|
set pReference = newClass.Properties_("pReference")
|
|
pReference.AddValues "root\cimv2:win32_logicaldisk"
|
|
scriptHelper.DisplayValue newClass, "pReference"
|
|
scriptHelper.VerifyValue pReference.Value, Array ("root\cimv2:win32_logicaldisk")
|
|
|
|
' Try an add of a simple value
|
|
pReference.AddValues "root\default:__cimomidentification=@"
|
|
scriptHelper.DisplayValue newClass, "pReference"
|
|
scriptHelper.VerifyValue pReference.Value, Array ("root\cimv2:win32_logicaldisk", "root\default:__cimomidentification=@")
|
|
|
|
' Try an add of a complex value
|
|
pReference.AddValues Array ("root\default:__cimomidentification=@", "root\cimv2:win32_logicaldisk")
|
|
scriptHelper.DisplayValue newClass, "pReference"
|
|
scriptHelper.VerifyValue pReference.Value, Array ("root\cimv2:win32_logicaldisk", _
|
|
"root\default:__cimomidentification=@", "root\default:__cimomidentification=@", "root\cimv2:win32_logicaldisk")
|
|
|
|
' Try an insert of a simple value
|
|
pReference.AddValues "\\foo\root\wibble", wbemAddValuesInsert, 1
|
|
scriptHelper.DisplayValue newClass, "pReference"
|
|
scriptHelper.VerifyValue pReference.Value, Array ("root\cimv2:win32_logicaldisk", "\\foo\root\wibble", _
|
|
"root\default:__cimomidentification=@", "root\default:__cimomidentification=@", "root\cimv2:win32_logicaldisk")
|
|
|
|
' Try an insert of a complex value
|
|
pReference.AddValues Array ("\\foo\root\wibble1", "\\foo2\root\wibble"), wbemAddValuesInsert, 4
|
|
scriptHelper.DisplayValue newClass, "pReference"
|
|
scriptHelper.VerifyValue pReference.Value, Array ("root\cimv2:win32_logicaldisk", "\\foo\root\wibble", _
|
|
"root\default:__cimomidentification=@", "root\default:__cimomidentification=@", _
|
|
"\\foo\root\wibble1", "\\foo2\root\wibble", "root\cimv2:win32_logicaldisk")
|
|
|
|
End Sub
|
|
|
|
'****************************************************************
|
|
'*
|
|
'* TestChar16
|
|
'* ==========
|
|
'*
|
|
'* Test AddValues for char16 arrays
|
|
'*
|
|
'****************************************************************
|
|
|
|
Sub TestChar16
|
|
|
|
on error resume next
|
|
' Try an add of a simple value
|
|
set pChar16 = newClass.Properties_("pChar16")
|
|
pChar16.AddValues 30
|
|
scriptHelper.DisplayValue newClass, "pChar16"
|
|
scriptHelper.VerifyValue pChar16.Value, Array (30)
|
|
|
|
' Try an add of a simple value
|
|
pChar16.AddValues 31
|
|
scriptHelper.DisplayValue newClass, "pChar16"
|
|
scriptHelper.VerifyValue pChar16.Value, Array (30, 31)
|
|
|
|
' Try an add of a complex value
|
|
pChar16.AddValues Array (32, 33)
|
|
scriptHelper.DisplayValue newClass, "pChar16"
|
|
scriptHelper.VerifyValue pChar16.Value, Array (30 ,31, 32, 33)
|
|
|
|
' Try an insert of a simple value
|
|
pChar16.AddValues 44, wbemAddValuesInsert, 1
|
|
scriptHelper.DisplayValue newClass, "pChar16"
|
|
scriptHelper.VerifyValue pChar16.Value, Array (30, 44, 31, 32, 33)
|
|
|
|
' Try an insert of a complex value
|
|
pChar16.AddValues Array (55, 56), wbemAddValuesInsert, 4
|
|
scriptHelper.DisplayValue newClass, "pChar16"
|
|
scriptHelper.VerifyValue pChar16.Value, Array (30, 44, 31, 32, 55, 56, 33)
|
|
|
|
End Sub
|
|
|
|
'****************************************************************
|
|
'*
|
|
'* TestObject
|
|
'* ==========
|
|
'*
|
|
'* Test AddValues for object arrays
|
|
'*
|
|
'****************************************************************
|
|
|
|
Sub TestObject
|
|
|
|
on error resume next
|
|
|
|
' Get an object to plug in
|
|
set sysClass = GetObject("winmgmts:__SystemClass")
|
|
set disk = GetObject("winmgmts:Win32_logicaldisk")
|
|
set process = GetObject("winmgmts:Win32_process")
|
|
|
|
' Try an add of a simple value
|
|
set pObject = newClass.Properties_("pObject")
|
|
pObject.AddValues sysClass
|
|
scriptHelper.DisplayValue newClass, "pObject"
|
|
scriptHelper.VerifyValue pObject.Value, Array (sysClass)
|
|
|
|
' Try an add of a simple value
|
|
pObject.AddValues disk
|
|
scriptHelper.DisplayValue newClass, "pObject"
|
|
scriptHelper.VerifyValue pObject.Value, Array (sysClass, disk)
|
|
|
|
' Try an add of a complex value
|
|
pObject.AddValues Array (sysClass, sysClass)
|
|
scriptHelper.DisplayValue newClass, "pObject"
|
|
scriptHelper.VerifyValue pObject.Value, Array (sysClass, disk, sysClass, sysClass)
|
|
|
|
' Try an insert of a simple value
|
|
pObject.AddValues process, wbemAddValuesInsert, 1
|
|
scriptHelper.DisplayValue newClass, "pObject"
|
|
scriptHelper.VerifyValue pObject.Value, Array (sysClass, process, disk, sysClass, sysClass)
|
|
|
|
' Try an insert of a complex value
|
|
pObject.AddValues Array (disk, process), wbemAddValuesInsert, 4
|
|
scriptHelper.DisplayValue newClass, "pObject"
|
|
scriptHelper.VerifyValue pObject.Value, Array (sysClass, process, disk, sysClass, disk, process, sysClass)
|
|
|
|
End Sub
|
|
|
|
</script>
|
|
</job>
|