CoreUtils/testing/zstring_test.cpp
2022-08-23 09:30:56 -07:00

36 lines
998 B
C++

#include <iostream>
#include "../ZString.h"
int main(int argc, char **argv) {
// Test comparison operations.
coreutils::ZString test1("");
std::cout << (test1 != ".") << std::endl;
// Test constructors.
coreutils::ZString test3("1659979856.747021214|barant@barant");
std::cout << test3 << std::endl;
// Test split operations.
coreutils::ZString test("11111:22222:33333:44444");
std::cout << "test pre-split: [" << test << "]." << std::endl;
test.split(":", 1);
std::cout << "test post-split: [" << test << "]." << std::endl;
std::cout << "test sections: [" << test.getList().size() << "]." << std::endl;
std::cout << test.getLength() << std::endl;
for(int ix = 0; ix < test.getList().size(); ++ix)
std::cout << ix << ":" << test[ix] << std::endl;
// Test substring operations.
coreutils::ZString test2("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
std::cout << "substring: [" << test2.substring(10) << "]" << std::endl;
}