Work in progress

Creating function for validateing element ID strings
This commit is contained in:
Michael Tryby
2019-04-16 14:44:06 -04:00
parent 8989be193a
commit ac56971ef2
5 changed files with 74 additions and 9 deletions

View File

@@ -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/)

View 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()