summaryrefslogtreecommitdiff
path: root/libmodman/test
diff options
context:
space:
mode:
Diffstat (limited to 'libmodman/test')
-rw-r--r--libmodman/test/CMakeLists.txt79
-rw-r--r--libmodman/test/builtin.cpp28
-rw-r--r--libmodman/test/main.cpp72
-rw-r--r--libmodman/test/main.hpp43
-rw-r--r--libmodman/test/module.cpp.in24
5 files changed, 0 insertions, 246 deletions
diff --git a/libmodman/test/CMakeLists.txt b/libmodman/test/CMakeLists.txt
deleted file mode 100644
index 168b130..0000000
--- a/libmodman/test/CMakeLists.txt
+++ /dev/null
@@ -1,79 +0,0 @@
-#####
-## LibModMan Tests
-####
-
-# Functions
-function(mm_create_module MODTYPE MODNAME MODCOND MODSYMB MODSMOD)
- configure_file(module.cpp.in
- ${CMAKE_CURRENT_BINARY_DIR}/${MODTYPE}_${MODNAME}.cpp
- @ONLY)
- add_library(${MODTYPE}_${MODNAME}
- MODULE
- ${CMAKE_CURRENT_BINARY_DIR}/${MODTYPE}_${MODNAME}.cpp)
- set_target_properties(${MODTYPE}_${MODNAME}
- PROPERTIES PREFIX ""
- LIBRARY_OUTPUT_DIRECTORY
- ${CMAKE_CURRENT_BINARY_DIR}/modules/${MODTYPE})
- target_link_libraries(${MODTYPE}_${MODNAME} modman)
-endfunction(mm_create_module)
-
-function(mm_create_program name EXTTYPE)
- add_executable(${name} main.cpp)
- target_link_libraries(${name} modman)
- set_property(TARGET ${name} PROPERTY
- COMPILE_DEFINITIONS
- EXTTYPE=${EXTTYPE}_extension)
- if(${ARGC} GREATER 2)
- target_link_libraries(${name} ${ARGN};modman)
- set_property(TARGET ${name} PROPERTY
- COMPILE_DEFINITIONS
- EXTTYPE=${EXTTYPE}_extension;SYMB=1)
- if(NOT WIN32 AND NOT APPLE)
- set_property(TARGET ${name} PROPERTY
- LINK_FLAGS -Wl,--no-as-needed)
- endif()
- endif()
-endfunction(mm_create_program)
-
-# Modules
-mm_create_module(condition one false NULL NULL)
-mm_create_module(condition two true NULL NULL)
-mm_create_module(singleton one true NULL NULL)
-mm_create_module(singleton two true NULL NULL)
-mm_create_module(sorted one true NULL NULL)
-mm_create_module(sorted two true NULL NULL)
-mm_create_module(builtin one true NULL NULL)
-if (WIN32)
- mm_create_module(symbol one true \"asdfoia\" \"ws2_32\")
- mm_create_module(symbol two true \"recv\" \"ws2_32\")
-else()
- mm_create_module(symbol one true \"asdfoia\" \"z\")
- mm_create_module(symbol two true \"deflate\" \"z\")
-endif()
-
-# Programs
-mm_create_program(condition condition)
-mm_create_program(singleton singleton)
-mm_create_program(sorted sorted)
-mm_create_program(symbol symbol)
-if (WIN32)
- mm_create_program(symbollnk symbol ws2_32)
-else()
- mm_create_program(symbollnk symbol z)
-endif()
-add_executable(builtin
- builtin.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/builtin_one.cpp)
-target_link_libraries(builtin modman)
-set_property(TARGET builtin PROPERTY COMPILE_DEFINITIONS
- EXTTYPE=builtin_extension;BUILTIN_MODULE=extension;MM_MODULE_BUILTIN=extension)
-
-# Tests
-add_test(NAME condition COMMAND condition $<TARGET_FILE_DIR:condition_one> two)
-add_test(NAME singleton COMMAND singleton $<TARGET_FILE_DIR:singleton_one> one)
-add_test(NAME sorted COMMAND sorted $<TARGET_FILE_DIR:sorted_one> two one)
-add_test(NAME symbol COMMAND symbollnk $<TARGET_FILE_DIR:symbol_one> two)
-add_test(NAME nosymbol COMMAND symbol $<TARGET_FILE_DIR:symbol_one>)
-add_test(NAME nosymreq COMMAND symbol $<TARGET_FILE_DIR:symbol_one> one)
-add_test(NAME builtin COMMAND builtin)
-
diff --git a/libmodman/test/builtin.cpp b/libmodman/test/builtin.cpp
deleted file mode 100644
index 8a3f328..0000000
--- a/libmodman/test/builtin.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * libmodman - A library for extending applications
- * Copyright (C) 2009 Nathaniel McCallum <nathaniel@natemccallum.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- ******************************************************************************/
-
-#include "main.hpp"
-
-MM_DEF_BUILTIN(BUILTIN_MODULE);
-
-int main() {
- module_manager mm;
- mm.register_type<EXTTYPE>();
- return !mm.load_builtin(& MM_BUILTIN(BUILTIN_MODULE));
-}
diff --git a/libmodman/test/main.cpp b/libmodman/test/main.cpp
deleted file mode 100644
index cf930c1..0000000
--- a/libmodman/test/main.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * libmodman - A library for extending applications
- * Copyright (C) 2009 Nathaniel McCallum <nathaniel@natemccallum.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- ******************************************************************************/
-
-#include <iostream>
-#include <vector>
-#include <cstring>
-#ifdef WIN32
-#ifdef SYMB
-#include <winsock2.h>
-#endif
-#endif
-
-#include "main.hpp"
-
-int main(int argc, const char** argv) {
- module_manager mm;
-#ifdef WIN32
-#ifdef SYMB
- void* symb = recv;
-#endif
-#endif
-
- if (argc < 2) {
- cout << "Usage: " << argv[0] << " MODULEDIR MODNAME ..." << endl;
- return 1;
- }
-
- if (!mm.register_type<EXTTYPE>()) {
- cout << "Unable to register type!" << endl;
- return 2;
- }
-
- if (!mm.load_dir(argv[1]) && argc > 2) {
- if (!mm.load_dir(argv[1], false)) {
- cout << "Unable to load modules!" << endl;
- return 3;
- }
- }
-
- vector<EXTTYPE*> exts = mm.get_extensions<EXTTYPE>();
- if (exts.size() != (unsigned int) argc - 2) {
- cout << "Wrong number of extensions found!" << endl;
- return 4;
- }
-
- for (unsigned int i=0 ; i < exts.size() ; i++) {
- if (!strstr(typeid(*(exts[i])).name(), argv[i+2])) {
- cout << "Unable to find extension! Here's the list:" << endl;
- for (unsigned int j=0 ; j < exts.size() ; j++)
- cout << "\t" << typeid(*(exts[j])).name() << endl;
- return 5;
- }
- }
-
- return 0;
-}
diff --git a/libmodman/test/main.hpp b/libmodman/test/main.hpp
deleted file mode 100644
index 0a08c63..0000000
--- a/libmodman/test/main.hpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * libmodman - A library for extending applications
- * Copyright (C) 2009 Nathaniel McCallum <nathaniel@natemccallum.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- ******************************************************************************/
-
-#ifndef MAIN_HPP_
-#define MAIN_HPP_
-
-#include <typeinfo>
-
-#include "../module_manager.hpp"
-
-using namespace std;
-using namespace libmodman;
-
-class __MM_DLL_EXPORT singleton_extension : public extension<singleton_extension, true> {};
-
-class __MM_DLL_EXPORT sorted_extension : public extension<sorted_extension> {
-public:
- virtual bool operator<(const base_extension& other) const {
- return string(typeid(*this).name()) > string(typeid(other).name());
- }
-};
-
-class __MM_DLL_EXPORT symbol_extension : public extension<symbol_extension> {};
-class __MM_DLL_EXPORT condition_extension : public extension<condition_extension> {};
-class __MM_DLL_EXPORT builtin_extension : public extension<builtin_extension> {};
-
-#endif /* MAIN_HPP_ */
diff --git a/libmodman/test/module.cpp.in b/libmodman/test/module.cpp.in
deleted file mode 100644
index 3390ead..0000000
--- a/libmodman/test/module.cpp.in
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * libmodman - A library for extending applications
- * Copyright (C) 2009 Nathaniel McCallum <nathaniel@natemccallum.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- ******************************************************************************/
-
-#include <libmodman/module.hpp>
-#include <libmodman/test/main.hpp>
-
-class @MODNAME@ : public @MODTYPE@_extension {};
-MM_MODULE_INIT_EZ(@MODNAME@, @MODCOND@, @MODSYMB@, @MODSMOD@);