diff options
| author | Martin Hořeňovský | 2017-08-10 11:34:26 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2017-08-10 11:34:26 +0200 |
| commit | aa42dd92d104e894e2b54d29a3defdf4b00eec21 (patch) | |
| tree | 4bdf430c746a2c98e6092705760d3f78c5421436 /test_package | |
| parent | e658bacb04ef5c14c1dcb192c9e5c99cef390582 (diff) | |
| parent | 7e4038d8488596e850a11c8fe236b59bca605444 (diff) | |
| download | catch3-aa42dd92d104e894e2b54d29a3defdf4b00eec21.tar.gz | |
Merge branch 'master' into dev-modernize
Diffstat (limited to 'test_package')
| -rw-r--r-- | test_package/CMakeLists.txt | 7 | ||||
| -rw-r--r-- | test_package/MainTest.cpp | 21 | ||||
| -rw-r--r-- | test_package/conanfile.py | 21 |
3 files changed, 49 insertions, 0 deletions
diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt new file mode 100644 index 00000000..339facbf --- /dev/null +++ b/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.0) +project(CatchTest CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${CMAKE_PROJECT_NAME} MainTest.cpp) diff --git a/test_package/MainTest.cpp b/test_package/MainTest.cpp new file mode 100644 index 00000000..b8ed744e --- /dev/null +++ b/test_package/MainTest.cpp @@ -0,0 +1,21 @@ +/* + * Created by Phil on 22/10/2010. + * Copyright 2010 Two Blue Cubes Ltd + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ +#define CATCH_CONFIG_MAIN +#include "catch.hpp" + +unsigned int Factorial( unsigned int number ) { + return number > 1 ? Factorial(number-1)*number : 1; +} + +TEST_CASE( "Factorials are computed", "[factorial]" ) { + REQUIRE( Factorial(0) == 1 ); + REQUIRE( Factorial(1) == 1 ); + REQUIRE( Factorial(2) == 2 ); + REQUIRE( Factorial(3) == 6 ); + REQUIRE( Factorial(10) == 3628800 ); +} diff --git a/test_package/conanfile.py b/test_package/conanfile.py new file mode 100644 index 00000000..9444b737 --- /dev/null +++ b/test_package/conanfile.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +from os import getenv +from os import path +from conans import ConanFile +from conans import CMake + + +class CatchConanTest(ConanFile): + generators = "cmake" + settings = "os", "compiler", "arch", "build_type" + username = getenv("CONAN_USERNAME", "philsquared") + channel = getenv("CONAN_CHANNEL", "testing") + requires = "Catch/1.9.5@%s/%s" % (username, channel) + + def build(self): + cmake = CMake(self) + cmake.configure(build_dir="./") + cmake.build() + + def test(self): + self.run(path.join("bin", "CatchTest")) |