diff options
author | Justin Clark-Casey (justincc) | 2013-02-14 21:34:57 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-02-14 21:34:57 +0000 |
commit | 13d4f6f747d3432f7b7d2f3e1d383dcdce91c01b (patch) | |
tree | 42eacdd70cfc818e9b00510e65ee3cdf22a001fb /OpenSim/Region | |
parent | Add regression TestJsonGetPathType() (diff) | |
download | opensim-SC_OLD-13d4f6f747d3432f7b7d2f3e1d383dcdce91c01b.zip opensim-SC_OLD-13d4f6f747d3432f7b7d2f3e1d383dcdce91c01b.tar.gz opensim-SC_OLD-13d4f6f747d3432f7b7d2f3e1d383dcdce91c01b.tar.bz2 opensim-SC_OLD-13d4f6f747d3432f7b7d2f3e1d383dcdce91c01b.tar.xz |
Add regression TestGetArrayLength()
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs index e5555d6..a457c7b 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | |||
@@ -399,6 +399,39 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
399 | } | 399 | } |
400 | 400 | ||
401 | [Test] | 401 | [Test] |
402 | public void TestGetArrayLength() | ||
403 | { | ||
404 | TestHelpers.InMethod(); | ||
405 | // TestHelpers.EnableLogging(); | ||
406 | |||
407 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : [ 'one', 2 ] } }"); | ||
408 | |||
409 | { | ||
410 | int result = (int)InvokeOp("JsonGetArrayLength", storeId, "Hello.World"); | ||
411 | Assert.That(result, Is.EqualTo(2)); | ||
412 | } | ||
413 | |||
414 | // Test path which is not an array | ||
415 | { | ||
416 | int result = (int)InvokeOp("JsonGetArrayLength", storeId, "Hello"); | ||
417 | Assert.That(result, Is.EqualTo(-1)); | ||
418 | } | ||
419 | |||
420 | // Test fake path | ||
421 | { | ||
422 | int result = (int)InvokeOp("JsonGetArrayLength", storeId, "foo"); | ||
423 | Assert.That(result, Is.EqualTo(-1)); | ||
424 | } | ||
425 | |||
426 | // Test fake store | ||
427 | { | ||
428 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); | ||
429 | int result = (int)InvokeOp("JsonGetArrayLength", fakeStoreId, "Hello.World"); | ||
430 | Assert.That(result, Is.EqualTo(-1)); | ||
431 | } | ||
432 | } | ||
433 | |||
434 | [Test] | ||
402 | public void TestJsonGetPathType() | 435 | public void TestJsonGetPathType() |
403 | { | 436 | { |
404 | TestHelpers.InMethod(); | 437 | TestHelpers.InMethod(); |