catch_version.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #include "catch_version.h"
  9. #include <ostream>
  10. namespace Catch {
  11. Version::Version
  12. ( unsigned int _majorVersion,
  13. unsigned int _minorVersion,
  14. unsigned int _patchNumber,
  15. char const * const _branchName,
  16. unsigned int _buildNumber )
  17. : majorVersion( _majorVersion ),
  18. minorVersion( _minorVersion ),
  19. patchNumber( _patchNumber ),
  20. branchName( _branchName ),
  21. buildNumber( _buildNumber )
  22. {}
  23. std::ostream& operator << ( std::ostream& os, Version const& version ) {
  24. os << version.majorVersion << '.'
  25. << version.minorVersion << '.'
  26. << version.patchNumber;
  27. // branchName is never null -> 0th char is \0 if it is empty
  28. if (version.branchName[0]) {
  29. os << '-' << version.branchName
  30. << '.' << version.buildNumber;
  31. }
  32. return os;
  33. }
  34. Version const& libraryVersion() {
  35. static Version version( 2, 13, 6, "", 0 );
  36. return version;
  37. }
  38. }