Skip to content
Snippets Groups Projects
Commit a46481fd authored by ilor's avatar ilor
Browse files

Add TSet to_string, some basic value tests, explicitly look for pwrutils, bump required versions

parent 9dcc1f05
No related merge requests found
FIND_PATH(PwrUtils_INCLUDE_DIR foreach.h /usr/include/libpwrutils /usr/local/include/libpwrutils )
FIND_LIBRARY(PwrUtils_LIBRARY NAMES pwrutils PATH /usr/lib /usr/local/lib)
MARK_AS_ADVANCED(PwrUtils_LIBRARY)
MARK_AS_ADVANCED(PwrUtils_INCLUDE_DIR)
IF (PwrUtils_INCLUDE_DIR AND PwrUtils_LIBRARY)
SET(PwrUtils_FOUND TRUE)
ENDIF (PwrUtils_INCLUDE_DIR AND PwrUtils_LIBRARY)
IF (PwrUtils_FOUND)
set(PwrUtils_VERSION 0.0.0)
FIND_FILE(_PwrUtils_VERSION_FILE version.h ${PwrUtils_INCLUDE_DIR})
MARK_AS_ADVANCED(_PwrUtils_VERSION_FILE)
IF (_PwrUtils_VERSION_FILE)
FILE(READ ${_PwrUtils_VERSION_FILE} _PwrUtils_VERSION_CONENTS)
STRING(REGEX REPLACE ".*#define LIBPWRUTILS_VERSION \\\"([0-9.]+)\\\".*" "\\1" PwrUtils_VERSION "${_PwrUtils_VERSION_CONENTS}")
ENDIF (_PwrUtils_VERSION_FILE)
IF (PwrUtils_FIND_VERSION)
IF (PwrUtils_VERSION VERSION_LESS PwrUtils_FIND_VERSION)
IF (PwrUtils_FIND_REQUIRED)
MESSAGE(${_PwrUtils_VERSION_FILE})
MESSAGE(FATAL_ERROR "PwrUtils version too old: ${PwrUtils_VERSION}, requested >= ${PwrUtils_FIND_VERSION}")
ELSE (PwrUtils_FIND_REQUIRED)
IF (NOT PwrUtils_FIND_QUIETLY)
MESSAGE(STATUS "PwrUtils version too old: ${PwrUtils_VERSION}, requested >= ${PwrUtils_FIND_VERSION}")
ENDIF (NOT PwrUtils_FIND_QUIETLY)
ENDIF (PwrUtils_FIND_REQUIRED)
set(PwrUtils_FOUND False)
ENDIF (PwrUtils_VERSION VERSION_LESS PwrUtils_FIND_VERSION)
ENDIF (PwrUtils_FIND_VERSION)
IF (NOT PwrUtils_FIND_QUIETLY)
MESSAGE(STATUS "Found libpwrutils ${PwrUtils_VERSION}: ${PwrUtils_LIBRARY}")
ENDIF (NOT PwrUtils_FIND_QUIETLY)
ELSE (PwrUtils_FOUND)
IF (PwrUtils_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find libpwrutils")
ELSE (PwrUtils_FIND_REQUIRED)
MESSAGE(STATUS "libpwrutils not found")
ENDIF (PwrUtils_FIND_REQUIRED)
ENDIF (PwrUtils_FOUND)
......@@ -4,9 +4,12 @@ PROJECT(wccl)
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/include/ )
find_package(Corpus2 0.1.0 REQUIRED)
find_package(Corpus2 0.1.1 REQUIRED)
set(LIBS ${LIBS} ${Corpus2_LIBRARY})
find_package(PwrUtils 0.0.3 REQUIRED)
set(LIBS ${LIBS} ${PwrUtils_LIBRARY})
link_directories(${Boost_LIBRARY_DIRS})
set(LIBS ${LIBS} ${Boost_LIBRARIES})
......@@ -26,7 +29,7 @@ SET(libwccl_STAT_SRC
file(GLOB_RECURSE INCS "*.h")
add_library(wccl SHARED ${libwccl_STAT_SRC} ${INCS})
target_link_libraries ( wccl ${LIBS} pwrutils)
target_link_libraries ( wccl ${LIBS} )
set_target_properties(wccl PROPERTIES
VERSION "${ver_major}.${ver_minor}"
......
#include <libwccl/values/tset.h>
#include <sstream>
namespace Wccl {
const char* TSet::type_name = "TSet";
std::string TSet::to_raw_string() const
{
return tag_.raw_dump();
}
std::string TSet::to_string(const Corpus2::Tagset& tagset) const
{
return tagset.tag_to_symbol_string(tag_);
}
} /* end ns Wccl */
......@@ -33,6 +33,10 @@ public:
return tag_;
}
std::string to_string(const Corpus2::Tagset &) const;
std::string to_raw_string() const;
private:
Corpus2::Tag tag_;
};
......
......@@ -5,10 +5,11 @@ include_directories( ${CMAKE_SOURCE_DIR} )
add_definitions(-DLIBWCCL_TEST_DATA_DIR="${PROJECT_SOURCE_DIR}/")
add_executable(tests
context.cpp
main.cpp
variables.cpp
position.cpp
context.cpp
values.cpp
variables.cpp
)
target_link_libraries ( tests wccl ${Boost_LIBRARIES})
......
#include <boost/test/unit_test.hpp>
#include <boost/bind.hpp>
#include <libwccl/variables.h>
#include <iostream>
using namespace Wccl;
BOOST_AUTO_TEST_SUITE(values)
BOOST_AUTO_TEST_CASE(boolz)
{
Bool b;
BOOST_CHECK_EQUAL(b.get_value(), false);
Value& v = b;
BOOST_CHECK_EQUAL(v.get_type_name(), Bool::type_name);
}
BOOST_AUTO_TEST_CASE(tsetz)
{
TSet t;
BOOST_CHECK(t.get_tag().is_null());
Value& v = t;
BOOST_CHECK_EQUAL(v.get_type_name(), TSet::type_name);
}
BOOST_AUTO_TEST_SUITE_END()
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment