summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/testRegistry.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-09-16 17:38:25 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-09-16 17:38:25 (GMT)
commit9b486bacfc98d6878b0e48f0136653c98cc5b385 (patch)
tree384840c4089ad1c8ffc927f9cfb831318ca3adab /Source/kwsys/testRegistry.cxx
parentcd510bf3ac1599b183b14e954dc273eae874d6a3 (diff)
downloadCMake-9b486bacfc98d6878b0e48f0136653c98cc5b385.zip
CMake-9b486bacfc98d6878b0e48f0136653c98cc5b385.tar.gz
CMake-9b486bacfc98d6878b0e48f0136653c98cc5b385.tar.bz2
ENH: Modify API a little bit to allow arbitrary length values. Encode certain characters. Rename UNIX registry to FILE registry. More testing
Diffstat (limited to 'Source/kwsys/testRegistry.cxx')
-rw-r--r--Source/kwsys/testRegistry.cxx35
1 files changed, 22 insertions, 13 deletions
diff --git a/Source/kwsys/testRegistry.cxx b/Source/kwsys/testRegistry.cxx
index 4f304d8..6906dac 100644
--- a/Source/kwsys/testRegistry.cxx
+++ b/Source/kwsys/testRegistry.cxx
@@ -53,14 +53,14 @@ int main(int, char**)
IFT(reg.SetValue("TestSubkey", "TestKey3", "Test Value 3"), res);
IFT(reg.SetValue("TestSubkey2", "TestKey4", "Test Value 4"), res);
- char buffer[1024];
- IFT(reg.ReadValue("TestSubkey", "TestKey1", buffer), res);
+ const char *buffer;
+ IFT(reg.ReadValue("TestSubkey", "TestKey1", &buffer), res);
CHE(buffer, "Test Value 1", res);
- IFT(reg.ReadValue("TestSubkey1", "TestKey2", buffer), res);
+ IFT(reg.ReadValue("TestSubkey1", "TestKey2", &buffer), res);
CHE(buffer, "Test Value 2", res);
- IFT(reg.ReadValue("TestSubkey", "TestKey3", buffer), res);
+ IFT(reg.ReadValue("TestSubkey", "TestKey3", &buffer), res);
CHE(buffer, "Test Value 3", res);
- IFT(reg.ReadValue("TestSubkey2", "TestKey4", buffer), res);
+ IFT(reg.ReadValue("TestSubkey2", "TestKey4", &buffer), res);
CHE(buffer, "Test Value 4", res);
IFT(reg.SetValue("TestSubkey", "TestKey1", "New Test Value 1"), res);
@@ -68,23 +68,32 @@ int main(int, char**)
IFT(reg.SetValue("TestSubkey", "TestKey3", "New Test Value 3"), res);
IFT(reg.SetValue("TestSubkey2", "TestKey4", "New Test Value 4"), res);
- IFT(reg.ReadValue("TestSubkey", "TestKey1", buffer), res);
+ IFT(reg.ReadValue("TestSubkey", "TestKey1", &buffer), res);
CHE(buffer, "New Test Value 1", res);
- IFT(reg.ReadValue("TestSubkey1", "TestKey2", buffer), res);
+ IFT(reg.ReadValue("TestSubkey1", "TestKey2", &buffer), res);
CHE(buffer, "New Test Value 2", res);
- IFT(reg.ReadValue("TestSubkey", "TestKey3", buffer), res);
+ IFT(reg.ReadValue("TestSubkey", "TestKey3", &buffer), res);
CHE(buffer, "New Test Value 3", res);
- IFT(reg.ReadValue("TestSubkey2", "TestKey4", buffer), res);
+ IFT(reg.ReadValue("TestSubkey2", "TestKey4", &buffer), res);
CHE(buffer, "New Test Value 4", res);
IFT( reg.DeleteValue("TestSubkey", "TestKey1"), res);
- IFNT(reg.ReadValue( "TestSubkey", "TestKey1", buffer), res);
+ IFNT(reg.ReadValue( "TestSubkey", "TestKey1", &buffer), res);
IFT( reg.DeleteValue("TestSubkey1", "TestKey2"), res);
- IFNT(reg.ReadValue( "TestSubkey1", "TestKey2", buffer), res);
+ IFNT(reg.ReadValue( "TestSubkey1", "TestKey2", &buffer), res);
IFT( reg.DeleteValue("TestSubkey", "TestKey3"), res);
- IFNT(reg.ReadValue( "TestSubkey", "TestKey3", buffer), res);
+ IFNT(reg.ReadValue( "TestSubkey", "TestKey3", &buffer), res);
IFT( reg.DeleteValue("TestSubkey2", "TestKey4"), res);
- IFNT(reg.ReadValue( "TestSubkey2", "TestKey5", buffer), res);
+ IFNT(reg.ReadValue( "TestSubkey2", "TestKey5", &buffer), res);
+
+ const char* longStringWithNewLines = "Value with embedded CR and LF characters CR='\015' LF='\012' CRLF='\015\012'";
+ IFT(reg.SetValue("TestSubkeyWithVeryLongInFactSoLongItsHardToImagineAnybodyWouldReallyDoItLongName", "TestKey1", longStringWithNewLines), res);
+ IFT(reg.ReadValue("TestSubkeyWithVeryLongInFactSoLongItsHardToImagineAnybodyWouldReallyDoItLongName", "TestKey1", &buffer), res);
+ CHE(buffer, longStringWithNewLines, res);
+
+ IFT(reg.SetValue("TestSubkeyWith = EqualSignChar", "TestKey = 1", "Some value"), res);
+ IFT(reg.ReadValue("TestSubkeyWith = EqualSignChar", "TestKey = 1", &buffer), res);
+ CHE(buffer, "Some value", res);
if ( res )
{