Phil Nash | 7673a30 | 2012-11-15 22:15:41 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Created by Phil on 14/11/2012. |
| 3 | * Copyright 2012 Two Blue Cubes Ltd. All rights reserved. |
| 4 | * |
| 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 7 | */ |
| 8 | #ifndef TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED |
| 9 | #define TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED |
| 10 | |
| 11 | #include "catch_version.h" |
| 12 | |
| 13 | namespace Catch { |
| 14 | |
Phil Nash | 21f7ef6 | 2015-06-29 18:05:23 +0100 | [diff] [blame] | 15 | Version::Version |
| 16 | ( unsigned int _majorVersion, |
| 17 | unsigned int _minorVersion, |
| 18 | unsigned int _patchNumber, |
Martin Hořeňovský | d07999d | 2017-03-22 17:45:36 +0100 | [diff] [blame] | 19 | char const * const _branchName, |
Phil Nash | 21f7ef6 | 2015-06-29 18:05:23 +0100 | [diff] [blame] | 20 | unsigned int _buildNumber ) |
| 21 | : majorVersion( _majorVersion ), |
| 22 | minorVersion( _minorVersion ), |
| 23 | patchNumber( _patchNumber ), |
| 24 | branchName( _branchName ), |
| 25 | buildNumber( _buildNumber ) |
| 26 | {} |
| 27 | |
| 28 | std::ostream& operator << ( std::ostream& os, Version const& version ) { |
Martin Hořeňovský | bcaa2f9 | 2017-01-29 23:07:15 +0100 | [diff] [blame] | 29 | os << version.majorVersion << '.' |
| 30 | << version.minorVersion << '.' |
Phil Nash | 21f7ef6 | 2015-06-29 18:05:23 +0100 | [diff] [blame] | 31 | << version.patchNumber; |
Martin Hořeňovský | d07999d | 2017-03-22 17:45:36 +0100 | [diff] [blame] | 32 | // branchName is never null -> 0th char is \0 if it is empty |
| 33 | if (version.branchName[0]) { |
| 34 | os << '-' << version.branchName |
| 35 | << '.' << version.buildNumber; |
Phil Nash | 21f7ef6 | 2015-06-29 18:05:23 +0100 | [diff] [blame] | 36 | } |
| 37 | return os; |
| 38 | } |
| 39 | |
Kevin Ushey | e04dc51 | 2017-03-16 11:17:45 -0700 | [diff] [blame] | 40 | inline Version libraryVersion() { |
Martin Hořeňovský | fc7f0a0 | 2017-04-25 11:08:02 +0200 | [diff] [blame^] | 41 | static Version version( 1, 9, 2, "", 0 ); |
Kevin Ushey | e04dc51 | 2017-03-16 11:17:45 -0700 | [diff] [blame] | 42 | return version; |
| 43 | } |
Phil Nash | 21f7ef6 | 2015-06-29 18:05:23 +0100 | [diff] [blame] | 44 | |
Phil Nash | 7673a30 | 2012-11-15 22:15:41 +0000 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED |