Added char * << to MString for string assignment.

This commit is contained in:
Brad Arant committed 2022-07-21 19:39:47 -07:00
1 parent 287933f9ce
commit d8df083d6b
5 files changed
+73 -1

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
#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;
coreutils::MString test2("this is another test.");
std::cout << "assign on constructor: [" << test2 << "]." << std::endl;
// Character assignment tests.
coreutils::MString test3;
test3 = 'a';
std::cout << "char operator=: [" << test3 << "]." << std::endl;
coreutils::MString test4;
test4 << "this is a test.";
std::cout << "char* operator<<: [" << test4 << "]." << std::endl;
// coreutils::ZString temp("this is literal zstring data.");
// coreutils::MString test = temp;
// std::cout << "operator=: [" << test << "]." << std::endl;
return 0;
}