diff options
author | Mic Bowman | 2013-03-05 20:33:17 -0800 |
---|---|---|
committer | Mic Bowman | 2013-03-05 20:33:17 -0800 |
commit | 9875e840f7e71f0b253c0b2aa90d47edc9c77b64 (patch) | |
tree | c2d71dc50c1f9eb48879d65038c6efd2ccca5686 /OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests | |
parent | Convert doubles passed back through the MOD interface into LSL_Floats (diff) | |
download | opensim-SC-9875e840f7e71f0b253c0b2aa90d47edc9c77b64.zip opensim-SC-9875e840f7e71f0b253c0b2aa90d47edc9c77b64.tar.gz opensim-SC-9875e840f7e71f0b253c0b2aa90d47edc9c77b64.tar.bz2 opensim-SC-9875e840f7e71f0b253c0b2aa90d47edc9c77b64.tar.xz |
Per discussions with justincc... split the JsonStore type
functions into one for node type and one for value type.
Define and export constants for both nodes and values.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs index b64dbd4..bfa9937 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | |||
@@ -158,8 +158,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
158 | 158 | ||
159 | Assert.That(dsrv, Is.EqualTo(1)); | 159 | Assert.That(dsrv, Is.EqualTo(1)); |
160 | 160 | ||
161 | int tprv = (int)InvokeOp("JsonGetPathType", storeId, "Hello"); | 161 | int tprv = (int)InvokeOp("JsonGetNodeType", storeId, "Hello"); |
162 | Assert.That(tprv, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); | 162 | Assert.That(tprv, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF)); |
163 | } | 163 | } |
164 | 164 | ||
165 | [Test] | 165 | [Test] |
@@ -277,8 +277,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
277 | int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello"); | 277 | int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello"); |
278 | Assert.That(returnValue, Is.EqualTo(1)); | 278 | Assert.That(returnValue, Is.EqualTo(1)); |
279 | 279 | ||
280 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello"); | 280 | int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello"); |
281 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); | 281 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF)); |
282 | 282 | ||
283 | string returnValue2 = (string)InvokeOp("JsonGetValue", storeId, "Hello"); | 283 | string returnValue2 = (string)InvokeOp("JsonGetValue", storeId, "Hello"); |
284 | Assert.That(returnValue2, Is.EqualTo("")); | 284 | Assert.That(returnValue2, Is.EqualTo("")); |
@@ -291,8 +291,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
291 | int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello"); | 291 | int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello"); |
292 | Assert.That(returnValue, Is.EqualTo(1)); | 292 | Assert.That(returnValue, Is.EqualTo(1)); |
293 | 293 | ||
294 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello"); | 294 | int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello"); |
295 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); | 295 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF)); |
296 | 296 | ||
297 | string returnValue2 = (string)InvokeOp("JsonGetJson", storeId, "Hello"); | 297 | string returnValue2 = (string)InvokeOp("JsonGetJson", storeId, "Hello"); |
298 | Assert.That(returnValue2, Is.EqualTo("")); | 298 | Assert.That(returnValue2, Is.EqualTo("")); |
@@ -306,11 +306,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
306 | int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello[0]"); | 306 | int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello[0]"); |
307 | Assert.That(returnValue, Is.EqualTo(1)); | 307 | Assert.That(returnValue, Is.EqualTo(1)); |
308 | 308 | ||
309 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello[0]"); | 309 | int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello[0]"); |
310 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_VALUE)); | 310 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_VALUE)); |
311 | 311 | ||
312 | result = (int)InvokeOp("JsonGetPathType", storeId, "Hello[1]"); | 312 | result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello[1]"); |
313 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); | 313 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF)); |
314 | 314 | ||
315 | string stringReturnValue = (string)InvokeOp("JsonGetValue", storeId, "Hello[0]"); | 315 | string stringReturnValue = (string)InvokeOp("JsonGetValue", storeId, "Hello[0]"); |
316 | Assert.That(stringReturnValue, Is.EqualTo("value2")); | 316 | Assert.That(stringReturnValue, Is.EqualTo("value2")); |
@@ -433,7 +433,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
433 | } | 433 | } |
434 | 434 | ||
435 | [Test] | 435 | [Test] |
436 | public void TestJsonGetPathType() | 436 | public void TestJsonGetNodeType() |
437 | { | 437 | { |
438 | TestHelpers.InMethod(); | 438 | TestHelpers.InMethod(); |
439 | // TestHelpers.EnableLogging(); | 439 | // TestHelpers.EnableLogging(); |
@@ -441,41 +441,41 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
441 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : [ 'one', 2 ] } }"); | 441 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : [ 'one', 2 ] } }"); |
442 | 442 | ||
443 | { | 443 | { |
444 | int result = (int)InvokeOp("JsonGetPathType", storeId, "."); | 444 | int result = (int)InvokeOp("JsonGetNodeType", storeId, "."); |
445 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_OBJECT)); | 445 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_OBJECT)); |
446 | } | 446 | } |
447 | 447 | ||
448 | { | 448 | { |
449 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello"); | 449 | int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello"); |
450 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_OBJECT)); | 450 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_OBJECT)); |
451 | } | 451 | } |
452 | 452 | ||
453 | { | 453 | { |
454 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello.World"); | 454 | int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello.World"); |
455 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_ARRAY)); | 455 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_ARRAY)); |
456 | } | 456 | } |
457 | 457 | ||
458 | { | 458 | { |
459 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello.World[0]"); | 459 | int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello.World[0]"); |
460 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_VALUE)); | 460 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_VALUE)); |
461 | } | 461 | } |
462 | 462 | ||
463 | { | 463 | { |
464 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello.World[1]"); | 464 | int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello.World[1]"); |
465 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_VALUE)); | 465 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_VALUE)); |
466 | } | 466 | } |
467 | 467 | ||
468 | // Test for non-existant path | 468 | // Test for non-existant path |
469 | { | 469 | { |
470 | int result = (int)InvokeOp("JsonGetPathType", storeId, "foo"); | 470 | int result = (int)InvokeOp("JsonGetNodeType", storeId, "foo"); |
471 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); | 471 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF)); |
472 | } | 472 | } |
473 | 473 | ||
474 | // Test for non-existant store | 474 | // Test for non-existant store |
475 | { | 475 | { |
476 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); | 476 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); |
477 | int result = (int)InvokeOp("JsonGetPathType", fakeStoreId, "."); | 477 | int result = (int)InvokeOp("JsonGetNodeType", fakeStoreId, "."); |
478 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); | 478 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF)); |
479 | } | 479 | } |
480 | } | 480 | } |
481 | 481 | ||