Work in progress
Creating function for validateing element ID strings
This commit is contained in:
@@ -7,6 +7,12 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
|
||||
|
||||
add_executable(test_cstrhelper ./test_cstrhelper.cpp
|
||||
../../src/util/cstr_helper.c)
|
||||
target_include_directories(test_cstrhelper PUBLIC ../../src/)
|
||||
target_link_libraries(test_cstrhelper ${Boost_LIBRARIES})
|
||||
|
||||
|
||||
add_executable(test_errormanager ./test_errormanager.cpp
|
||||
../../src/util/errormanager.c)
|
||||
target_include_directories(test_errormanager PUBLIC ../../src/)
|
||||
|
||||
33
tests/util/test_cstrhelper.cpp
Normal file
33
tests/util/test_cstrhelper.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
Project: OWA EPANET
|
||||
Version: 2.2
|
||||
Module: test_cstrhelper.cpp
|
||||
Description: tests for C string helper functions
|
||||
Authors: see AUTHORS
|
||||
Copyright: see AUTHORS
|
||||
License: see LICENSE
|
||||
Last Updated: 04/16/2019
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#define BOOST_TEST_MODULE cstr_helper
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "util/cstr_helper.h"
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(test_cstrhelper)
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_validate_id){
|
||||
|
||||
BOOST_CHECK(cstr_validate_id("big tank") == false);
|
||||
BOOST_CHECK(cstr_validate_id("big\"tank") == false);
|
||||
BOOST_CHECK(cstr_validate_id("big;tank") == false);
|
||||
|
||||
BOOST_CHECK(cstr_validate_id("big-tank") == true);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
Reference in New Issue
Block a user