test:添加测试模块。
This commit is contained in:
parent
837a4c8dd6
commit
320b01eab4
@ -23,6 +23,7 @@ set(SRC_FILES
|
|||||||
include_directories(include)
|
include_directories(include)
|
||||||
if(DEFINED USE_TEST)
|
if(DEFINED USE_TEST)
|
||||||
message(STATUS "USE TEST")
|
message(STATUS "USE TEST")
|
||||||
|
enable_testing()
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -8,6 +8,6 @@ if (MSVC)
|
|||||||
add_compile_options(/source-charset:utf-8)
|
add_compile_options(/source-charset:utf-8)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
add_executable(ofTest main.cpp)
|
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 <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()
|
int main()
|
||||||
{
|
{
|
||||||
|
testA();
|
||||||
|
testB();
|
||||||
std::cout << "Done" << std::endl;
|
std::cout << "Done" << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user