41 lines
915 B
C++
41 lines
915 B
C++
#include <iostream>
|
|
#include <of_str.h>
|
|
#include <of_path.h>
|
|
#include <of_util.h>
|
|
#include <cassert>
|
|
|
|
using namespace ofen;
|
|
|
|
void testA()
|
|
{
|
|
assert(COfPath::is_same_path(ofT("D:/Java"), ofT("D:\\Java\\")));
|
|
}
|
|
|
|
void testB()
|
|
{
|
|
auto home = COfPath::get_home();
|
|
assert(!home.empty());
|
|
|
|
auto rp = COfStr::replace(ofT("cpp/z"), ofT("p/"), ofT("Ni"));
|
|
assert(rp == ofT("cpNiz"));
|
|
}
|
|
|
|
void testC()
|
|
{
|
|
std::string source(u8"这是 一 个测试 用例。 ");
|
|
std::string expect(u8"这是一个测试用例。");
|
|
assert(CCodec::rbs(source) == expect);
|
|
|
|
std::string source1(u8"1. 氣 壓 不 足 2. I/O 輸出未 設 定3.氣壓缸異常");
|
|
std::string expect1(u8"1.氣壓不足2.I/O輸出未設定3.氣壓缸異常");
|
|
assert(CCodec::rbs(source1) == expect1);
|
|
}
|
|
|
|
int main()
|
|
{
|
|
testA();
|
|
testB();
|
|
testC();
|
|
std::cout << "Done" << std::endl;
|
|
return 0;
|
|
} |