merge
This commit is contained in:
commit
badfc4c709
12 files changed
+166
-45
No files matched your search
@@ -17,16 +17,19 @@ int main(int argc, char **argv) {
|
||||
// std::cout << test1 << std::endl;
|
||||
|
||||
coreutils::JString test2("{\"key1\":[{\"id\":\"1\",\"name\":\"Brad\"},{\"id\":\"2\",\"name\":\"Jenn\"},{\"id\":\"3\",\"name\":\"Skye\"}],\"key2\":\"data5\",\"key3\":\"data3\",\"key4\":\"data4\"}");
|
||||
|
||||
std::cout << test2 << std::endl;
|
||||
std::cout << "--------" << std::endl;
|
||||
// std::cout << test2["key2"] << std::endl;
|
||||
// std::cout << test2["key1"] << std::endl;
|
||||
// std::cout << "value: " << test2["key1.name[id=2]"] << std::endl;
|
||||
// std::cout << "value: " << test2["key1.name[id=3]"] << std::endl;
|
||||
|
||||
test2["key2"] = "newvalue1";
|
||||
std::cout << test2["key2"] << std::endl;
|
||||
std::cout << "--------" << std::endl;
|
||||
// test2 = "newvalue";
|
||||
std::cout << test2 << std::endl;
|
||||
std::cout << test2 << std::endl;
|
||||
std::cout << "--------" << std::endl;
|
||||
std::cout << "key2: " << test2["key2"] << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
#include <iostream>
|
||||
#include "../MString.h"
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
// Literal string assignment tests.
|
||||
coreutils::MString test1 = "this is an assignment test.";
|
||||
std::cout << "char * operator=: [" << test1 << "]." << std::endl;
|
||||
test1 = "new value.";
|
||||
std::cout << "char * operator=: [" << test1 << "]." << std::endl;
|
||||
std::cout << "char * operator=: [" << test1 << "]." << std::endl;
|
||||
std::string test11 = "this is a test";
|
||||
coreutils::MString test12 = test11;
|
||||
std::cout << "assign from std::string: [" << test12 << "]." << std::endl;
|
||||
|
||||
coreutils::MString test2("this is another test.");
|
||||
std::cout << "assign on constructor: [" << test2 << "]." << std::endl;
|
||||
@@ -28,22 +31,31 @@ int main(int argc, char **argv) {
|
||||
std::cout << "char* operator<<: [" << test4 << "]." << std::endl;
|
||||
test4 << "another test " << 75;
|
||||
std::cout << "char* operator<<: [" << test4 << "]." << std::endl;
|
||||
|
||||
|
||||
// Stream assignment capabilities.
|
||||
coreutils::MString test6;
|
||||
int number = 75;
|
||||
test6 << "Will this work? " << number << test4 << " See how this works.";
|
||||
std::cout << "streaming: [" << test6 << "]." << std::endl;
|
||||
std::cout << "streaming: [" << test6 << "]." << std::endl;
|
||||
std::string test13 = "stream from string test";
|
||||
coreutils::MString test14;
|
||||
test14 << test13;
|
||||
std::cout << "streaming from std::string: [" << test14 << "]." << std::endl;
|
||||
|
||||
coreutils::MString test9("XXXXXXXXXYYYYYYYYYY");
|
||||
std::cout << "test insert: " << test9 << std::endl;
|
||||
coreutils::MString test8("zzz");
|
||||
test9.insert(test8, 9);
|
||||
std::cout << "inserting: " << test9 << std::endl;
|
||||
test9.insert("aaaaa", 9);
|
||||
std::cout << "inserting: " << test9 << std::endl;
|
||||
test9.remove(10, 7);
|
||||
std::cout << "removing: " << test9 << std::endl;
|
||||
|
||||
// Reassignments.
|
||||
|
||||
coreutils::MString test10;
|
||||
test10 = "";
|
||||
std::cout << test10 << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -38,5 +38,10 @@ int main(int argc, char **argv) {
|
||||
test4.getTokenExclude("(");
|
||||
std::cout << "container: " << test4.getContainer() << std::endl;
|
||||
std::cout << "rest: " << test4.unparsed() << std::endl;
|
||||
|
||||
|
||||
// Test find();
|
||||
coreutils::ZString testA("this is a test string for MX 250xyzabc");
|
||||
std::cout << "find MX: " << testA.find("MX") << std::endl;
|
||||
std::cout << "unparsed: " << testA.unparsed() << std::endl;
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user