Leaked source code of windows server 2003
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.

689 lines
20 KiB

  1. <!--
  2. ******************************************************************
  3. '
  4. ' deletevalues.wsf
  5. '
  6. ' Purpose: test SWbemPropertyEx::DeleteValues
  7. '
  8. ' Parameters: none
  9. '
  10. ' Returns: 0 - success
  11. ' 1 - failure
  12. '
  13. '*****************************************************************
  14. -->
  15. <job id="WMI DeleteValues Test">
  16. <reference object="WbemScripting.SWbemLocator" version="1.2"/>
  17. <script language="VBScript">
  18. on error resume next
  19. set scriptHelper = CreateObject("WMIScriptHelper.WSC")
  20. scriptHelper.logFile = "c:\temp\deletevalues.txt"
  21. scriptHelper.loggingLevel = 3
  22. scriptHelper.testName = "WMI DeleteValues"
  23. scriptHelper.testStart
  24. dim ns
  25. dim newClass
  26. dim sysClass, disk, process
  27. ' Get some useful classes for embedded objects
  28. set sysClass = GetObject("winmgmts:__SystemClass")
  29. set disk = GetObject("winmgmts:Win32_logicaldisk")
  30. set process = GetObject("winmgmts:Win32_process")
  31. if err <> 0 then
  32. scriptHelper.writeErrorToLog err, "Failed to get utility classes"
  33. else
  34. scriptHelper.writeToLog "Successful retrieval of utility classes", 2
  35. end if
  36. ' Connect to the namespace
  37. set ns = GetObject("winmgmts:root\default")
  38. if err <> 0 then
  39. scriptHelper.writeErrorToLog err, "Failed to connect to root\default"
  40. else
  41. scriptHelper.writeToLog "Successful connection to root\default", 2
  42. end if
  43. 'Make a new class
  44. set newClass = ns.Get
  45. if err <> 0 then
  46. scriptHelper.writeErrorToLog err, "Failed to get empty class"
  47. else
  48. scriptHelper.writeToLog "Successful retrieval of empty class", 2
  49. end if
  50. newClass.Path_.Class = "DELETEVALUES000TEST"
  51. ' Add a non-array property (uint32)
  52. set p0 = newClass.Properties_.Add ("p0", 19)
  53. p0 = 251
  54. ' Add some array properties, one for each type
  55. set p = newClass.Properties_.Add ("pSint8", wbemCimtypeSint8, true)
  56. p.Value = Array (-1, 0, 3, 1, 2, 3)
  57. set p = newClass.Properties_.Add ("pUint8", wbemCimtypeUint8, true)
  58. p.Value = Array (0, 1, 123, 222, 1, 0, 1)
  59. set p = newClass.Properties_.Add ("pSint16", wbemCimtypeSint16, true)
  60. p.Value = Array (-1, 0, 1, 3, -4)
  61. set p = newClass.Properties_.Add ("pUint16", wbemCimtypeUint16, true)
  62. p.Value = Array (0, 1, 65535, 23)
  63. set p = newClass.Properties_.Add ("pSint32", wbemCimtypeSint32, true)
  64. p.Value = Array (-1, 0, 1, 2, 89)
  65. set p = newClass.Properties_.Add ("pUint32", wbemCimtypeUint32, true)
  66. p.Value = Array (0, 1, 65535, 26)
  67. set p = newClass.Properties_.Add ("pSint64", wbemCimtypeSint64, true)
  68. p.Value = Array ("-1", "0", "1", "2", "11")
  69. set p = newClass.Properties_.Add ("pUint64", wbemCimtypeUint64, true)
  70. p.Value = Array ("0", "1", "65535", "123", "65535")
  71. set p = newClass.Properties_.Add ("pReal32", wbemCimtypeReal32, true)
  72. p.Value = Array (1.2, -123.456, 23.004, 34.44)
  73. set p = newClass.Properties_.Add ("pReal64", wbemCimtypeReal64, true)
  74. p.Value = Array (1.2, -123.456, 23.004, 332.1)
  75. set p = newClass.Properties_.Add ("pBoolean", wbemCimtypeBoolean, true)
  76. p.Value = Array (true, false, true, true)
  77. set p = newClass.Properties_.Add ("pString", wbemCimtypeString, true)
  78. p.Value = Array ("I", "have", "but", "an", "hour", "Obey", "the", "time")
  79. set p = newClass.Properties_.Add ("pDatetime", wbemCimtypeDatetime, true)
  80. p.Value = Array ("20000120195632.000000-480", _
  81. "20000120195632.000000+480", "20000120195632.000000-480", "20000120195632.000000-480")
  82. set p = newClass.Properties_.Add ("pReference", wbemCimtypeReference, true)
  83. p.Value = Array ("root\cimv2:win32_logicaldisk", _
  84. "root\default:__cimomidentification=@", "root\default:__cimomidentification=@", _
  85. "root\cimv2:win32_logicaldisk")
  86. set p = newClass.Properties_.Add ("pChar16", wbemCimtypeChar16, true)
  87. p.Value = Array (34, 35, 36, 37)
  88. set p = newClass.Properties_.Add ("pObject", wbemCimtypeObject, true)
  89. p.Value = Array (sysClass, disk, process, disk)
  90. if err <> 0 then
  91. scriptHelper.writeErrorToLog err, "Failed to define class"
  92. else
  93. scriptHelper.writeToLog "Successful definition of class", 2
  94. end if
  95. ' Save the class
  96. newClass.Put_
  97. if err <> 0 then
  98. scriptHelper.writeErrorToLog err, "Failed to save class"
  99. else
  100. scriptHelper.writeToLog "Successful save of class", 2
  101. end if
  102. ' Get it back
  103. set newClass = ns.Get ("DELETEVALUES000TEST")
  104. if err <> 0 then
  105. scriptHelper.writeErrorToLog err, "Failed to get class"
  106. else
  107. scriptHelper.writeToLog "Successful get of class", 2
  108. end if
  109. ' now test each property type
  110. TestUint8
  111. TestSint8
  112. TestUint16
  113. TestSint16
  114. TestUint32
  115. TestSint32
  116. TestUint64
  117. TestSint64
  118. TestReal32
  119. TestReal64
  120. TestBoolean
  121. TestString
  122. TestDatetime
  123. TestReference
  124. TestChar16
  125. TestObject
  126. ' Save the class
  127. newClass.Put_
  128. if err <> 0 then
  129. scriptHelper.writeErrorToLog err, "Failed to save class"
  130. else
  131. scriptHelper.writeToLog "Successful save of class", 2
  132. end if
  133. ' Clean up
  134. newClass.Delete_
  135. if err <> 0 then
  136. scriptHelper.writeErrorToLog err, "Failed to delete class"
  137. else
  138. scriptHelper.writeToLog "Successful delete of class", 2
  139. end if
  140. scriptHelper.testComplete
  141. if scriptHelper.statusOK then
  142. WScript.Echo "PASS"
  143. WScript.Quit 0
  144. else
  145. WScript.Echo "FAIL"
  146. WScript.Quit 1
  147. end if
  148. '****************************************************************
  149. '*
  150. '* TestUint8
  151. '* =========
  152. '*
  153. '* Test AddValues for uint8 arrays
  154. '*
  155. '****************************************************************
  156. Sub TestUint8
  157. on error resume next
  158. ' Try a delete of first match
  159. set pUint8 = newClass.Properties_("pUint8")
  160. pUint8.DeleteValues 123
  161. scriptHelper.DisplayValue newClass, "pUint8"
  162. scriptHelper.VerifyValue pUint8.Value, Array (0, 1, 222, 1, 0, 1)
  163. ' Try a delete of all matches
  164. pUint8.DeleteValues Array (0, 1), wbemDeleteValuesDeleteAllMatches
  165. scriptHelper.DisplayValue newClass, "pUint8"
  166. scriptHelper.VerifyValue pUint8.Value, Array (222)
  167. ' Try a delete of all
  168. pUint8.DeleteValues , wbemDeleteValuesDeleteAll
  169. scriptHelper.DisplayValue newClass, "pUint8"
  170. scriptHelper.VerifyValue pUint8.Value, Array ()
  171. End Sub
  172. '****************************************************************
  173. '*
  174. '* TestSint8
  175. '* =========
  176. '*
  177. '* Test AddValues for sint8 arrays
  178. '*
  179. '****************************************************************
  180. Sub TestSint8
  181. on error resume next
  182. ' Try a delete of first match
  183. set pSint8 = newClass.Properties_("pSint8")
  184. pSint8.DeleteValues Array (0, 22, 3)
  185. scriptHelper.DisplayValue newClass, "pSint8"
  186. scriptHelper.VerifyValue pSint8.Value, Array (-1, 3, 1, 2, 3)
  187. ' Try a delete of all matches within a range
  188. pSint8.DeleteValues Array (3, 1), wbemDeleteValuesDeleteAllMatches, 1, 2
  189. scriptHelper.DisplayValue newClass, "pSint8"
  190. scriptHelper.VerifyValue pSint8.Value, Array (-1, 2, 3)
  191. ' Try a delete of all
  192. pSint8.DeleteValues , wbemDeleteValuesDeleteAll
  193. scriptHelper.DisplayValue newClass, "pSint8"
  194. scriptHelper.VerifyValue pSint8.Value, Array ()
  195. End Sub
  196. '****************************************************************
  197. '*
  198. '* TestString
  199. '* ============
  200. '*
  201. '* Test AddValues for string arrays
  202. '*
  203. '****************************************************************
  204. Sub TestString
  205. on error resume next
  206. ' Try a delete of first match
  207. set pString = newClass.Properties_("pString")
  208. pString.DeleteValues "Obey", wbemDeleteValuesDeleteFirstMatch, 5, -1
  209. scriptHelper.DisplayValue newClass, "pString"
  210. scriptHelper.VerifyValue pString.Value, Array ("I", "have", "but", "an", "hour", "the", "time")
  211. ' Try a delete of all matches within a range
  212. pString.DeleteValues Array ("I", "You", "Me", "the"), wbemDeleteValuesDeleteAllMatches, 0, 5
  213. scriptHelper.DisplayValue newClass, "pString"
  214. scriptHelper.VerifyValue pString.Value, Array ("have", "but", "an", "hour", "time")
  215. ' Try a delete of all
  216. pString.DeleteValues , wbemDeleteValuesDeleteAll
  217. scriptHelper.DisplayValue newClass, "pString"
  218. scriptHelper.VerifyValue pString.Value, Array ()
  219. End Sub
  220. '****************************************************************
  221. '*
  222. '* TestUint16
  223. '* ==========
  224. '*
  225. '* Test AddValues for uint16 arrays
  226. '*
  227. '****************************************************************
  228. Sub TestUint16
  229. on error resume next
  230. ' Try a delete of first match
  231. set pUint16 = newClass.Properties_("pUint16")
  232. pUint16.DeleteValues Array (2, 3, 4, 54, 23), wbemDeleteValuesDeleteFirstMatch, 0, -1
  233. scriptHelper.DisplayValue newClass, "pUint16"
  234. scriptHelper.VerifyValue pUint16.Value, Array (0, 1, 65535)
  235. ' Try a delete of all matches within a range
  236. pUint16.DeleteValues Array (0, 65535), wbemDeleteValuesDeleteAllMatches
  237. scriptHelper.DisplayValue newClass, "pUint16"
  238. scriptHelper.VerifyValue pUint16.Value, Array (1)
  239. ' Try a delete of all
  240. pUint16.DeleteValues , wbemDeleteValuesDeleteAll
  241. scriptHelper.DisplayValue newClass, "pUint16"
  242. scriptHelper.VerifyValue pUint16.Value, Array ()
  243. End Sub
  244. '****************************************************************
  245. '*
  246. '* TestSint16
  247. '* ==========
  248. '*
  249. '* Test AddValues for sint16 arrays
  250. '*
  251. '****************************************************************
  252. Sub TestSint16
  253. on error resume next
  254. ' Try a delete of first match
  255. set pSint16 = newClass.Properties_("pSint16")
  256. pSint16.DeleteValues -1, wbemDeleteValuesDeleteFirstMatch
  257. scriptHelper.DisplayValue newClass, "pSint16"
  258. scriptHelper.VerifyValue pSint16.Value, Array (0, 1, 3, -4)
  259. ' Try a delete of all matches within a range
  260. pSint16.DeleteValues Array (0, 65535, -4), wbemDeleteValuesDeleteAllMatches
  261. scriptHelper.DisplayValue newClass, "pSint16"
  262. scriptHelper.VerifyValue pSint16.Value, Array (1, 3)
  263. ' Try a delete of all
  264. pSint16.DeleteValues , wbemDeleteValuesDeleteAll
  265. scriptHelper.DisplayValue newClass, "pSint16"
  266. scriptHelper.VerifyValue pSint16.Value, Array ()
  267. End Sub
  268. '****************************************************************
  269. '*
  270. '* TestUint32
  271. '* ==========
  272. '*
  273. '* Test AddValues for uint32 arrays
  274. '*
  275. '****************************************************************
  276. Sub TestUint32
  277. on error resume next
  278. ' Try a delete of first match
  279. set pUint32 = newClass.Properties_("pUint32")
  280. pUint32.DeleteValues 1, wbemDeleteValuesDeleteFirstMatch
  281. scriptHelper.DisplayValue newClass, "pUint32"
  282. scriptHelper.VerifyValue pUint32.Value, Array (0, 65535, 26)
  283. ' Try a delete of all matches within a range
  284. pUint32.DeleteValues Array (0, 65535, -4), wbemDeleteValuesDeleteAllMatches
  285. scriptHelper.DisplayValue newClass, "pUint32"
  286. scriptHelper.VerifyValue pUint32.Value, Array (26)
  287. ' Try a delete of all
  288. pUint32.DeleteValues , wbemDeleteValuesDeleteAll
  289. scriptHelper.DisplayValue newClass, "pUint32"
  290. scriptHelper.VerifyValue pUint32.Value, Array ()
  291. End Sub
  292. '****************************************************************
  293. '*
  294. '* TestSint32
  295. '* ==========
  296. '*
  297. '* Test AddValues for sint32 arrays
  298. '*
  299. '****************************************************************
  300. Sub TestSint32
  301. on error resume next
  302. ' Try a delete of first match
  303. set pSint32 = newClass.Properties_("pSint32")
  304. pSint32.DeleteValues 11, wbemDeleteValuesDeleteFirstMatch
  305. scriptHelper.DisplayValue newClass, "pSint32"
  306. scriptHelper.VerifyValue pSint32.Value, Array (-1, 0, 1, 2, 89)
  307. ' Try a delete of all matches within a range
  308. pSint32.DeleteValues Array (0, 65535, -4, 2, 89), wbemDeleteValuesDeleteAllMatches, 0, 2
  309. scriptHelper.DisplayValue newClass, "pSint32"
  310. scriptHelper.VerifyValue pSint32.Value, Array (-1, 1, 2, 89)
  311. ' Try a delete of all
  312. pSint32.DeleteValues , wbemDeleteValuesDeleteAll
  313. scriptHelper.DisplayValue newClass, "pSint32"
  314. scriptHelper.VerifyValue pSint32.Value, Array ()
  315. End Sub
  316. '****************************************************************
  317. '*
  318. '* TestUint64
  319. '* ==========
  320. '*
  321. '* Test AddValues for uint64 arrays
  322. '*
  323. '****************************************************************
  324. Sub TestUint64
  325. on error resume next
  326. ' Try a delete of first match
  327. set pUint64 = newClass.Properties_("pUint64")
  328. pUint64.DeleteValues "1", wbemDeleteValuesDeleteFirstMatch
  329. scriptHelper.DisplayValue newClass, "pUint64"
  330. scriptHelper.VerifyValue pUint64.Value, Array ("0", "65535", "123", "65535")
  331. ' Try a delete of all matches within a range
  332. pUint64.DeleteValues Array ("65535"), wbemDeleteValuesDeleteAllMatches, 0, 2
  333. scriptHelper.DisplayValue newClass, "pUint64"
  334. scriptHelper.VerifyValue pUint64.Value, Array ("0", "123", "65535")
  335. ' Try a delete of all
  336. pUint64.DeleteValues , wbemDeleteValuesDeleteAll
  337. scriptHelper.DisplayValue newClass, "pUint64"
  338. scriptHelper.VerifyValue pUint64.Value, Array ()
  339. End Sub
  340. '****************************************************************
  341. '*
  342. '* TestSint64
  343. '* ==========
  344. '*
  345. '* Test AddValues for sint64 arrays
  346. '*
  347. '****************************************************************
  348. Sub TestSint64
  349. on error resume next
  350. ' Try a delete of first match
  351. set pSint64 = newClass.Properties_("pSint64")
  352. pSint64.DeleteValues "21", wbemDeleteValuesDeleteFirstMatch
  353. scriptHelper.DisplayValue newClass, "pSint64"
  354. scriptHelper.VerifyValue pSint64.Value, Array ("-1", "0", "1", "2", "11")
  355. ' Try a delete of all matches within a range
  356. pSint64.DeleteValues Array ("-1", "11"), wbemDeleteValuesDeleteAllMatches, 0, 2
  357. scriptHelper.DisplayValue newClass, "pSint64"
  358. scriptHelper.VerifyValue pSint64.Value, Array ("0", "1", "2", "11")
  359. ' Try a delete of all
  360. pSint64.DeleteValues , wbemDeleteValuesDeleteAll
  361. scriptHelper.DisplayValue newClass, "pSint64"
  362. scriptHelper.VerifyValue pSint64.Value, Array ()
  363. End Sub
  364. '****************************************************************
  365. '*
  366. '* TestReal32
  367. '* ==========
  368. '*
  369. '* Test AddValues for real32 arrays
  370. '*
  371. '****************************************************************
  372. Sub TestReal32
  373. on error resume next
  374. ' NB - note the use of CSng to force constants to be of type
  375. ' VT_R4. If we don't do this the supplied constant is of
  376. ' type VT_R8 (default for VB and VBScript). This internally
  377. ' causes floating point rounding errors when comparing against
  378. ' VT_R4's since VT_R4 to VT_R8 conversion is not "pad with 0's".
  379. ' Try a delete of first match
  380. set pReal32 = newClass.Properties_("pReal32")
  381. pReal32.DeleteValues CSng(1.2), wbemDeleteValuesDeleteFirstMatch
  382. scriptHelper.DisplayValue newClass, "pReal32"
  383. scriptHelper.VerifyValue pReal32.Value, Array (-123.456, 23.004, 34.44)
  384. ' Try a delete of all matches within a range
  385. pReal32.DeleteValues Array (CSng(0), CSng(65535), CSng(34.44)), wbemDeleteValuesDeleteAllMatches
  386. scriptHelper.DisplayValue newClass, "pReal32"
  387. scriptHelper.VerifyValue pReal32.Value, Array (-123.456, 23.004)
  388. ' Try a delete of all
  389. pReal32.DeleteValues , wbemDeleteValuesDeleteAll
  390. scriptHelper.DisplayValue newClass, "pReal32"
  391. scriptHelper.VerifyValue pReal32.Value, Array ()
  392. End Sub
  393. '****************************************************************
  394. '*
  395. '* TestReal64
  396. '* ==========
  397. '*
  398. '* Test AddValues for real64 arrays
  399. '*
  400. '****************************************************************
  401. Sub TestReal64
  402. on error resume next
  403. ' Try a delete of first match
  404. set pReal64 = newClass.Properties_("pReal64")
  405. pReal64.DeleteValues 332.1, wbemDeleteValuesDeleteFirstMatch
  406. scriptHelper.DisplayValue newClass, "pReal64"
  407. scriptHelper.VerifyValue pReal64.Value, Array (1.2, -123.456, 23.004)
  408. ' Try a delete of first match
  409. pReal64.DeleteValues 32.1, wbemDeleteValuesDeleteFirstMatch
  410. scriptHelper.DisplayValue newClass, "pReal64"
  411. scriptHelper.VerifyValue pReal64.Value, Array (1.2, -123.456, 23.004)
  412. ' Try a delete of all matches within a range
  413. pReal64.DeleteValues Array (23.004, -123.456), wbemDeleteValuesDeleteAllMatches
  414. scriptHelper.DisplayValue newClass, "pReal64"
  415. scriptHelper.VerifyValue pReal64.Value, Array (1.2)
  416. ' Try a delete of all matches within a range
  417. pReal64.DeleteValues Array (23.004, -123.456), wbemDeleteValuesDeleteAllMatches
  418. scriptHelper.DisplayValue newClass, "pReal64"
  419. scriptHelper.VerifyValue pReal64.Value, Array (1.2)
  420. ' Try a delete of all
  421. pReal64.DeleteValues , wbemDeleteValuesDeleteAll
  422. scriptHelper.DisplayValue newClass, "pReal64"
  423. scriptHelper.VerifyValue pReal64.Value, Array ()
  424. End Sub
  425. '****************************************************************
  426. '*
  427. '* TestBoolean
  428. '* ===========
  429. '*
  430. '* Test AddValues for boolean arrays
  431. '*
  432. '****************************************************************
  433. Sub TestBoolean
  434. on error resume next
  435. ' Try a delete of first match
  436. set pBoolean = newClass.Properties_("pBoolean")
  437. pBoolean.DeleteValues true, wbemDeleteValuesDeleteFirstMatch, 1
  438. scriptHelper.DisplayValue newClass, "pBoolean"
  439. scriptHelper.VerifyValue pBoolean.Value, Array (true, false, true)
  440. ' Try a delete of all matches within a range
  441. pBoolean.DeleteValues Array (true, true), wbemDeleteValuesDeleteAllMatches
  442. scriptHelper.DisplayValue newClass, "pBoolean"
  443. scriptHelper.VerifyValue pBoolean.Value, Array (false)
  444. ' Try a delete of all
  445. pBoolean.DeleteValues , wbemDeleteValuesDeleteAll
  446. scriptHelper.DisplayValue newClass, "pBoolean"
  447. scriptHelper.VerifyValue pBoolean.Value, Array ()
  448. End Sub
  449. '****************************************************************
  450. '*
  451. '* TestDatetime
  452. '* ============
  453. '*
  454. '* Test AddValues for datetime arrays
  455. '*
  456. '****************************************************************
  457. Sub TestDatetime
  458. on error resume next
  459. ' Try a delete of first match
  460. set pDatetime = newClass.Properties_("pDatetime")
  461. pDatetime.DeleteValues "20000120195632.000000-480", wbemDeleteValuesDeleteFirstMatch, 1
  462. scriptHelper.DisplayValue newClass, "pDatetime"
  463. scriptHelper.VerifyValue pDatetime.Value, Array ("20000120195632.000000-480", _
  464. "20000120195632.000000+480", "20000120195632.000000-480")
  465. ' Try a delete of all matches within a range
  466. pDatetime.DeleteValues Array ("20000120195632.000000-480", "20000120195632.000000-480"), _
  467. wbemDeleteValuesDeleteAllMatches, , 1
  468. scriptHelper.DisplayValue newClass, "pDatetime"
  469. scriptHelper.VerifyValue pDatetime.Value, Array ("20000120195632.000000+480", "20000120195632.000000-480")
  470. ' Try a delete of all
  471. pDatetime.DeleteValues , wbemDeleteValuesDeleteAll
  472. scriptHelper.DisplayValue newClass, "pDatetime"
  473. scriptHelper.VerifyValue pDatetime.Value, Array ()
  474. End Sub
  475. '****************************************************************
  476. '*
  477. '* TestReference
  478. '* =============
  479. '*
  480. '* Test AddValues for reference arrays
  481. '*
  482. '****************************************************************
  483. Sub TestReference
  484. on error resume next
  485. ' Try a delete of first match
  486. set pReference = newClass.Properties_("pReference")
  487. pReference.DeleteValues Array ("root\cimv2:win32_logicaldisk", _
  488. "root\default:__cimomidentification=@"), wbemDeleteValuesDeleteFirstMatch
  489. scriptHelper.DisplayValue newClass, "pReference"
  490. scriptHelper.VerifyValue pReference.Value, Array ("root\default:__cimomidentification=@", _
  491. "root\default:__cimomidentification=@", "root\cimv2:win32_logicaldisk")
  492. ' Try a delete of all matches within a range
  493. pReference.DeleteValues Array ("root\default:__cimomidentification=@", _
  494. "root\default:__cimomidentification=@", "root\cimv2:win32_logicaldisk"), _
  495. wbemDeleteValuesDeleteAllMatches
  496. scriptHelper.DisplayValue newClass, "pReference"
  497. scriptHelper.VerifyValue pReference.Value, Array ()
  498. ' Try a delete of all
  499. pReference.Value = null
  500. pReference.DeleteValues , wbemDeleteValuesDeleteAll
  501. scriptHelper.DisplayValue newClass, "pReference"
  502. scriptHelper.VerifyValue pReference.Value, null
  503. End Sub
  504. '****************************************************************
  505. '*
  506. '* TestChar16
  507. '* ==========
  508. '*
  509. '* Test AddValues for char16 arrays
  510. '*
  511. '****************************************************************
  512. Sub TestChar16
  513. on error resume next
  514. ' Try a delete of first match
  515. set pChar16 = newClass.Properties_("pChar16")
  516. pChar16.DeleteValues 35, wbemDeleteValuesDeleteFirstMatch
  517. scriptHelper.DisplayValue newClass, "pChar16"
  518. scriptHelper.VerifyValue pChar16.Value, Array (34, 36, 37)
  519. ' Try a delete of all matches within a range
  520. pChar16.DeleteValues Array (35, 36, 34, 42, 43, 44), wbemDeleteValuesDeleteAllMatches
  521. scriptHelper.DisplayValue newClass, "pChar16"
  522. scriptHelper.VerifyValue pChar16.Value, Array (37)
  523. ' Try a delete of all
  524. pChar16.DeleteValues , wbemDeleteValuesDeleteAll
  525. scriptHelper.DisplayValue newClass, "pChar16"
  526. scriptHelper.VerifyValue pChar16.Value, Array ()
  527. End Sub
  528. '****************************************************************
  529. '*
  530. '* TestObject
  531. '* ==========
  532. '*
  533. '* Test AddValues for object arrays
  534. '*
  535. '****************************************************************
  536. Sub TestObject
  537. on error resume next
  538. End Sub
  539. </script>
  540. </job>