test:添加测试模块。
This commit is contained in:
parent
837a4c8dd6
commit
320b01eab4
@ -23,6 +23,7 @@ set(SRC_FILES
|
||||
include_directories(include)
|
||||
if(DEFINED USE_TEST)
|
||||
message(STATUS "USE TEST")
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
|
@ -8,6 +8,6 @@ if (MSVC)
|
||||
add_compile_options(/source-charset:utf-8)
|
||||
endif()
|
||||
|
||||
|
||||
add_executable(ofTest main.cpp)
|
||||
target_link_libraries(ofTest PRIVATE Ofen)
|
||||
target_link_libraries(ofTest PRIVATE Ofen)
|
||||
add_test(NAME ofTest COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ofTest)
|
@ -1,7 +1,27 @@
|
||||
#include <iostream>
|
||||
#include "of_path.h"
|
||||
#include <cassert>
|
||||
|
||||
using namespace ofen;
|
||||
|
||||
void testA()
|
||||
{
|
||||
assert(COfPath::isSamePath(ofT("D:/Java"), ofT("D:\\Java\\")));
|
||||
}
|
||||
|
||||
void testB()
|
||||
{
|
||||
auto home = COfPath::getHome();
|
||||
assert(!home.empty());
|
||||
|
||||
auto rp = COfPath::replaceStr(ofT("cpp/z"), ofT("p/"), ofT("Ni"));
|
||||
assert(rp == ofT("cpNiz"));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
testA();
|
||||
testB();
|
||||
std::cout << "Done" << std::endl;
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user