Skip to content

Commit

Permalink
Adding first physical constant.
Browse files Browse the repository at this point in the history
  • Loading branch information
jlconlin committed Sep 13, 2018
1 parent 215d3e0 commit 1fb65fa
Show file tree
Hide file tree
Showing 10 changed files with 159 additions and 98 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bin
subprojects
__pycache__
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "dependencies/catch-adapter"]
path = dependencies/catch-adapter
url = https://github.com/njoy/catch-adapter.git
[submodule "dependencies/dimwits"]
path = dependencies/dimwits
url = https://github.com/njoy/DimensionalAnalysis.git
188 changes: 100 additions & 88 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ project( constants LANGUAGES CXX )
get_directory_property( is_subproject PARENT_DIRECTORY )
include( CMakeDependentOption REQUIRED )

set( constants_Clang_minimum_version 3.8 )
set( constants_GNU_minimum_version 6.2 )
set( constants_AppleClang_minimum_version 8.0 )
set( constants_GNU_minimum_version 6.2 )
set( constants_Clang_minimum_version 3.8 )

if( constants_${CMAKE_CXX_COMPILER_ID}_minimum_version )
if( CMAKE_CXX_COMPILER_VERSION AND
Expand Down Expand Up @@ -75,66 +75,30 @@ if ( profile_generate )
file( MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/profiling" )
endif()

set( constants_Clang_Windows_common_flags "-stdlib=libc++" "-Wall" "-Wextra" "-Wpedantic" "-std=c++14" )
set( constants_Clang_Windows_DEBUG_flags "-O0" "-g" "-gdwarf-3" )
set( constants_Clang_Windows_RELEASE_flags "-O3" "-DNDEBUG" )
set( constants_Clang_Windows_strict_flags "-Werror" )
set( constants_Clang_Windows_coverage_flags "--coverage" )
set( constants_Clang_Windows_subproject_flags )
set( constants_Clang_Windows_base_project_flags )
set( constants_Clang_Windows_profile_generate_flags "-fprofile-generate='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_Windows_link_time_optimization_flags "-flto" )
set( constants_Clang_Windows_profile_use_flags "-fprofile-use='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_Windows_nonportable_optimization_flags "-march=native" )
set( constants_Clang_Windows_static_flags "-static" )
set( constants_Clang_Darwin_common_flags "-stdlib=libc++" "-Wall" "-Wextra" "-Wpedantic" "-std=c++14" )
set( constants_Clang_Darwin_DEBUG_flags "-O0" "-g" "-gdwarf-3" )
set( constants_Clang_Darwin_RELEASE_flags "-O3" "-DNDEBUG" )
set( constants_Clang_Darwin_strict_flags "-Werror" )
set( constants_Clang_Darwin_coverage_flags "--coverage" )
set( constants_Clang_Darwin_subproject_flags )
set( constants_Clang_Darwin_base_project_flags )
set( constants_Clang_Darwin_profile_generate_flags "-fprofile-generate='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_Darwin_link_time_optimization_flags "-flto" )
set( constants_Clang_Darwin_profile_use_flags "-fprofile-use='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_Darwin_nonportable_optimization_flags "-march=native" )
set( constants_Clang_Darwin_static_flags "-static" )
set( constants_Clang_CYGWIN_common_flags "-Wno-subobject-linkage" "-Wall" "-Wextra" "-Wpedantic" "-std=gnu++14" )
set( constants_Clang_CYGWIN_DEBUG_flags "-O0" "-g" "-gdwarf-3" "-fsignaling-nans" )
set( constants_Clang_CYGWIN_RELEASE_flags "-O3" "-DNDEBUG" )
set( constants_Clang_CYGWIN_strict_flags "-Werror" )
set( constants_Clang_CYGWIN_coverage_flags "--coverage" )
set( constants_Clang_CYGWIN_subproject_flags )
set( constants_Clang_CYGWIN_base_project_flags )
set( constants_Clang_CYGWIN_profile_generate_flags "-fprofile-generate='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_CYGWIN_link_time_optimization_flags "-flto" )
set( constants_Clang_CYGWIN_profile_use_flags "-fprofile-use='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_CYGWIN_nonportable_optimization_flags "-march=native" )
set( constants_Clang_CYGWIN_static_flags "-static" )
set( constants_Clang_Linux_common_flags "-stdlib=libstdc++" "-Wall" "-Wextra" "-Wpedantic" "-std=c++14" )
set( constants_Clang_Linux_DEBUG_flags "-O0" "-g" "-gdwarf-3" )
set( constants_Clang_Linux_RELEASE_flags "-O3" "-DNDEBUG" )
set( constants_Clang_Linux_strict_flags "-Werror" )
set( constants_Clang_Linux_coverage_flags "--coverage" )
set( constants_Clang_Linux_subproject_flags )
set( constants_Clang_Linux_base_project_flags )
set( constants_Clang_Linux_profile_generate_flags "-fprofile-generate='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_Linux_link_time_optimization_flags "-flto" )
set( constants_Clang_Linux_profile_use_flags "-fprofile-use='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_Linux_nonportable_optimization_flags "-march=native" )
set( constants_Clang_Linux_static_flags "-static" )
set( constants_Clang_MinGW_common_flags "-Wno-subobject-linkage" "-Wall" "-Wextra" "-Wpedantic" "-std=c++14" )
set( constants_Clang_MinGW_DEBUG_flags "-O0" "-g" "-gdwarf-3" "-fsignaling-nans" )
set( constants_Clang_MinGW_RELEASE_flags "-O3" "-DNDEBUG" )
set( constants_Clang_MinGW_strict_flags "-Werror" )
set( constants_Clang_MinGW_coverage_flags "--coverage" )
set( constants_Clang_MinGW_subproject_flags )
set( constants_Clang_MinGW_base_project_flags )
set( constants_Clang_MinGW_profile_generate_flags "-fprofile-generate='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_MinGW_link_time_optimization_flags "-flto" )
set( constants_Clang_MinGW_profile_use_flags "-fprofile-use='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_MinGW_nonportable_optimization_flags "-march=native" )
set( constants_Clang_MinGW_static_flags "-static" )
set( constants_AppleClang_Darwin_common_flags "-stdlib=libc++" "-Wall" "-Wextra" "-Wpedantic" "-std=c++14" )
set( constants_AppleClang_Darwin_DEBUG_flags "-O0" "-g" "-gdwarf-3" )
set( constants_AppleClang_Darwin_RELEASE_flags "-O3" "-DNDEBUG" )
set( constants_AppleClang_Darwin_strict_flags "-Werror" )
set( constants_AppleClang_Darwin_coverage_flags "--coverage" )
set( constants_AppleClang_Darwin_subproject_flags )
set( constants_AppleClang_Darwin_base_project_flags )
set( constants_AppleClang_Darwin_profile_generate_flags "-fprofile-generate='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_AppleClang_Darwin_link_time_optimization_flags "-flto" )
set( constants_AppleClang_Darwin_profile_use_flags "-fprofile-use='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_AppleClang_Darwin_nonportable_optimization_flags "-march=native" )
set( constants_AppleClang_Darwin_static_flags "-static" )
set( constants_GNU_MinGW_common_flags "-Wno-subobject-linkage" "-Wall" "-Wextra" "-Wpedantic" "-std=c++14" )
set( constants_GNU_MinGW_DEBUG_flags "-O0" "-g" "-gdwarf-3" "-fsignaling-nans" )
set( constants_GNU_MinGW_RELEASE_flags "-O3" "-DNDEBUG" )
set( constants_GNU_MinGW_strict_flags "-Werror" )
set( constants_GNU_MinGW_coverage_flags "--coverage" )
set( constants_GNU_MinGW_subproject_flags )
set( constants_GNU_MinGW_base_project_flags )
set( constants_GNU_MinGW_profile_generate_flags "-fprofile-generate='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_GNU_MinGW_link_time_optimization_flags "-flto" )
set( constants_GNU_MinGW_profile_use_flags "-fprofile-use='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_GNU_MinGW_nonportable_optimization_flags "-march=native" )
set( constants_GNU_MinGW_static_flags "-static" )
set( constants_GNU_Windows_common_flags "-Wno-subobject-linkage" "-Wall" "-Wextra" "-Wpedantic" "-std=c++14" )
set( constants_GNU_Windows_DEBUG_flags "-O0" "-g" "-gdwarf-3" "-fsignaling-nans" )
set( constants_GNU_Windows_RELEASE_flags "-O3" "-DNDEBUG" )
Expand Down Expand Up @@ -183,36 +147,80 @@ set( constants_GNU_Linux_link_time_optimization_flags "-flto" )
set( constants_GNU_Linux_profile_use_flags "-fprofile-use='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_GNU_Linux_nonportable_optimization_flags "-march=native" )
set( constants_GNU_Linux_static_flags "-static" )
set( constants_GNU_MinGW_common_flags "-Wno-subobject-linkage" "-Wall" "-Wextra" "-Wpedantic" "-std=c++14" )
set( constants_GNU_MinGW_DEBUG_flags "-O0" "-g" "-gdwarf-3" "-fsignaling-nans" )
set( constants_GNU_MinGW_RELEASE_flags "-O3" "-DNDEBUG" )
set( constants_GNU_MinGW_strict_flags "-Werror" )
set( constants_GNU_MinGW_coverage_flags "--coverage" )
set( constants_GNU_MinGW_subproject_flags )
set( constants_GNU_MinGW_base_project_flags )
set( constants_GNU_MinGW_profile_generate_flags "-fprofile-generate='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_GNU_MinGW_link_time_optimization_flags "-flto" )
set( constants_GNU_MinGW_profile_use_flags "-fprofile-use='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_GNU_MinGW_nonportable_optimization_flags "-march=native" )
set( constants_GNU_MinGW_static_flags "-static" )
set( constants_AppleClang_Darwin_common_flags "-stdlib=libc++" "-Wall" "-Wextra" "-Wpedantic" "-std=c++14" )
set( constants_AppleClang_Darwin_DEBUG_flags "-O0" "-g" "-gdwarf-3" )
set( constants_AppleClang_Darwin_RELEASE_flags "-O3" "-DNDEBUG" )
set( constants_AppleClang_Darwin_strict_flags "-Werror" )
set( constants_AppleClang_Darwin_coverage_flags "--coverage" )
set( constants_AppleClang_Darwin_subproject_flags )
set( constants_AppleClang_Darwin_base_project_flags )
set( constants_AppleClang_Darwin_profile_generate_flags "-fprofile-generate='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_AppleClang_Darwin_link_time_optimization_flags "-flto" )
set( constants_AppleClang_Darwin_profile_use_flags "-fprofile-use='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_AppleClang_Darwin_nonportable_optimization_flags "-march=native" )
set( constants_AppleClang_Darwin_static_flags "-static" )
set( constants_Clang_MinGW_common_flags "-Wno-subobject-linkage" "-Wall" "-Wextra" "-Wpedantic" "-std=c++14" )
set( constants_Clang_MinGW_DEBUG_flags "-O0" "-g" "-gdwarf-3" "-fsignaling-nans" )
set( constants_Clang_MinGW_RELEASE_flags "-O3" "-DNDEBUG" )
set( constants_Clang_MinGW_strict_flags "-Werror" )
set( constants_Clang_MinGW_coverage_flags "--coverage" )
set( constants_Clang_MinGW_subproject_flags )
set( constants_Clang_MinGW_base_project_flags )
set( constants_Clang_MinGW_profile_generate_flags "-fprofile-generate='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_MinGW_link_time_optimization_flags "-flto" )
set( constants_Clang_MinGW_profile_use_flags "-fprofile-use='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_MinGW_nonportable_optimization_flags "-march=native" )
set( constants_Clang_MinGW_static_flags "-static" )
set( constants_Clang_Windows_common_flags "-stdlib=libc++" "-Wall" "-Wextra" "-Wpedantic" "-std=c++14" )
set( constants_Clang_Windows_DEBUG_flags "-O0" "-g" "-gdwarf-3" )
set( constants_Clang_Windows_RELEASE_flags "-O3" "-DNDEBUG" )
set( constants_Clang_Windows_strict_flags "-Werror" )
set( constants_Clang_Windows_coverage_flags "--coverage" )
set( constants_Clang_Windows_subproject_flags )
set( constants_Clang_Windows_base_project_flags )
set( constants_Clang_Windows_profile_generate_flags "-fprofile-generate='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_Windows_link_time_optimization_flags "-flto" )
set( constants_Clang_Windows_profile_use_flags "-fprofile-use='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_Windows_nonportable_optimization_flags "-march=native" )
set( constants_Clang_Windows_static_flags "-static" )
set( constants_Clang_Darwin_common_flags "-stdlib=libc++" "-Wall" "-Wextra" "-Wpedantic" "-std=c++14" )
set( constants_Clang_Darwin_DEBUG_flags "-O0" "-g" "-gdwarf-3" )
set( constants_Clang_Darwin_RELEASE_flags "-O3" "-DNDEBUG" )
set( constants_Clang_Darwin_strict_flags "-Werror" )
set( constants_Clang_Darwin_coverage_flags "--coverage" )
set( constants_Clang_Darwin_subproject_flags )
set( constants_Clang_Darwin_base_project_flags )
set( constants_Clang_Darwin_profile_generate_flags "-fprofile-generate='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_Darwin_link_time_optimization_flags "-flto" )
set( constants_Clang_Darwin_profile_use_flags "-fprofile-use='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_Darwin_nonportable_optimization_flags "-march=native" )
set( constants_Clang_Darwin_static_flags "-static" )
set( constants_Clang_CYGWIN_common_flags "-Wno-subobject-linkage" "-Wall" "-Wextra" "-Wpedantic" "-std=gnu++14" )
set( constants_Clang_CYGWIN_DEBUG_flags "-O0" "-g" "-gdwarf-3" "-fsignaling-nans" )
set( constants_Clang_CYGWIN_RELEASE_flags "-O3" "-DNDEBUG" )
set( constants_Clang_CYGWIN_strict_flags "-Werror" )
set( constants_Clang_CYGWIN_coverage_flags "--coverage" )
set( constants_Clang_CYGWIN_subproject_flags )
set( constants_Clang_CYGWIN_base_project_flags )
set( constants_Clang_CYGWIN_profile_generate_flags "-fprofile-generate='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_CYGWIN_link_time_optimization_flags "-flto" )
set( constants_Clang_CYGWIN_profile_use_flags "-fprofile-use='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_CYGWIN_nonportable_optimization_flags "-march=native" )
set( constants_Clang_CYGWIN_static_flags "-static" )
set( constants_Clang_Linux_common_flags "-stdlib=libstdc++" "-Wall" "-Wextra" "-Wpedantic" "-std=c++14" )
set( constants_Clang_Linux_DEBUG_flags "-O0" "-g" "-gdwarf-3" )
set( constants_Clang_Linux_RELEASE_flags "-O3" "-DNDEBUG" )
set( constants_Clang_Linux_strict_flags "-Werror" )
set( constants_Clang_Linux_coverage_flags "--coverage" )
set( constants_Clang_Linux_subproject_flags )
set( constants_Clang_Linux_base_project_flags )
set( constants_Clang_Linux_profile_generate_flags "-fprofile-generate='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_Linux_link_time_optimization_flags "-flto" )
set( constants_Clang_Linux_profile_use_flags "-fprofile-use='${CMAKE_BINARY_DIR}/profiling'" )
set( constants_Clang_Linux_nonportable_optimization_flags "-march=native" )
set( constants_Clang_Linux_static_flags "-static" )
get_directory_property( is_subproject PARENT_DIRECTORY )

if( NOT TARGET catch-adapter )
add_subdirectory( ${ROOT_DIRECTORY}/subprojects/catch-adapter )
endif()

if( NOT TARGET hana-adapter )
add_subdirectory( ${ROOT_DIRECTORY}/subprojects/hana-adapter )
endif()

if( NOT TARGET dimwits )
add_subdirectory( ${ROOT_DIRECTORY}/subprojects/dimwits )
endif()


if ( NOT GIT_EXECUTABLE )
find_package( Git )
Expand Down Expand Up @@ -245,20 +253,24 @@ message( STATUS "-----------------------------------------------------------" )

add_library( constants INTERFACE )
target_sources( constants INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/src/constants.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/constants/math.hpp" )
"${CMAKE_CURRENT_SOURCE_DIR}/src/constants/math.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/constants/physics.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/constants/physics/CODATA.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/constants/physics/CODATA2014.hpp" )

target_include_directories( constants INTERFACE src )

set( PREFIX constants_${CMAKE_CXX_COMPILER_ID}_${CMAKE_SYSTEM_NAME} )

target_link_libraries( constants INTERFACE "$<$<AND:$<CONFIG:RELEASE>,$<BOOL:${link_time_optimization}>>:${${PREFIX}_RELEASE_flags};${${PREFIX}_link_time_optimization_flags}$<$<BOOL:${profile_generate}>:${${PREFIX}_profile_generate_flags};>$<$<BOOL:${profile_use}>:${${PREFIX}_profile_use_flags};>$<$<BOOL:${nonportable_optimization}>:${${PREFIX}_nonportable_optimization_flags};>>$<$<CONFIG:DEBUG>:$<$<BOOL:${coverage}>:${${PREFIX}_coverage_flags};>>$<$<BOOL:CXX_appended_flags>:${CXX_appended_flags};>$<$<BOOL:constants_appended_flags>:${constants_appended_flags};>" )

target_link_libraries( constants INTERFACE catch-adapter )
target_link_libraries( constants INTERFACE catch-adapter INTERFACE dimwits )

if( NOT is_subproject )
enable_testing()
if ( unit_tests )
add_subdirectory( src/constants/math/test )
add_subdirectory( src/constants/physics/CODATA2014/test )
endif()
endif()

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# constants
This repository contains a collection of mathematical and physical constants.

**Note:** For the mathematical constants, their values are actually given in three places in this repository:

1. Here in the `README.md` file,
2. In the header file that defines the value for C++, and
3. In the files used to test/verify the values.
While every effort is made to ensure that each of these values are the same, inconsistencies may appear. If discovered, please [file an issue](https://github.com/njoy/constants/issues).

## Mathematical Constants
The (short) list of mathematical constants was taken from [Wikipedia:Mathematical constant](https://en.wikipedia.org/wiki/Mathematical_constant). While there are many more constants given there, we have limited this initially to the [Basic mathematical constants](https://en.wikipedia.org/wiki/Mathematical_constant#Basic_mathematical_constants).
Expand All @@ -11,12 +17,6 @@ The (short) list of mathematical constants was taken from [Wikipedia:Mathematica
| Euler's number (e) | `e` | `2.718281828459045` | [http://mathworld.wolfram.com/e.html]() | 2018-09-13 |
| Pythagoras' constant (√2) | `root2` | `1.414213562373095` | [http://mathworld.wolfram.com/PythagorassConstant.html]() | 2018-09-13 |

**Note:** For the mathematical constants, their values are actually given in three places in this repository:

1. Here in the `README.md` file,
2. In the header file that defines the value for C++, and
3. In the `math.test.cpp` file used to test/verify the values.
While every effort is made to ensure that each of these values are the same, inconsistencies may appear. If discovered, please [file an issue](https://github.com/njoy/constants/issues).

### Using mathematical constants
Here is an example of how the mathematical constants can be used.
Expand Down
1 change: 1 addition & 0 deletions dependencies/dimwits
Submodule dimwits added at d60ddd
8 changes: 7 additions & 1 deletion metaconfigure/description.json
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,10 @@
},
"header files": [
"src/constants.hpp",
"src/constants/math.hpp"
"src/constants/math.hpp",
"src/constants/physics.hpp",
"src/constants/physics/CODATA.hpp",
"src/constants/physics/CODATA2014.hpp"
],
"ignore pattern": "$^",
"implementation files": [],
Expand All @@ -594,6 +597,9 @@
"tests": {
"constants.math": [
"src/constants/math/test/math.test.cpp"
],
"constants.physics.CODATA2014": [
"src/constants/physics/CODATA2014/test/CODATA2014.test.cpp"
]
},
"update": true
Expand Down
10 changes: 7 additions & 3 deletions src/constants/physics/CODATA.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#ifndef NJOY_CONSTANTS_PHYSICS_CODATA_HPP
#define NJOY_CONSTANTS_PHYSICS_CODATA_HPP

#include "dimwits.hpp"
using namespace dimwits;

namespace njoy{
namespace constants{
namespace physics{

static SpeedOfLight_t{};
static constexpr SpeedOfLight_t c{};
static constexpr SpeedOfLight_t speedOfLight{};
struct SpeedOfLight: hana::type< SpeedOfLight >{};
static constexpr SpeedOfLight speedOfLight{};
struct C: hana::type< C >{};
static constexpr C c{};

}
} // namespace constants
Expand Down
5 changes: 5 additions & 0 deletions src/constants/physics/CODATA2014.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ namespace njoy{
namespace constants{
namespace physics{

auto CODATA2014 = hana::make_map(
hana::make_pair( speedOfLight, 299792458*meter/second ),
hana::make_pair( c, 299792458*meter/second )
);

}
} // namespace constants
} // namespace njoy
Expand Down
14 changes: 14 additions & 0 deletions src/constants/physics/CODATA2014/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

add_executable( constants.physics.CODATA2014.test CODATA2014.test.cpp )
target_compile_options( constants.physics.CODATA2014.test PRIVATE ${${PREFIX}_common_flags}
$<$<BOOL:${strict}>:${${PREFIX}_strict_flags}>$<$<CONFIG:DEBUG>:
${${PREFIX}_DEBUG_flags}
$<$<BOOL:${coverage}>:${${PREFIX}_coverage_flags}>>
$<$<CONFIG:RELEASE>:
${${PREFIX}_RELEASE_flags}
$<$<BOOL:${link_time_optimization}>:${${PREFIX}_link_time_optimization_flags}>
$<$<BOOL:${nonportable_optimization}>:${${PREFIX}_nonportable_optimization_flags}>>

${CXX_appended_flags} ${constants_appended_flags} )
target_link_libraries( constants.physics.CODATA2014.test PUBLIC constants )
add_test( NAME constants.physics.CODATA2014 COMMAND constants.physics.CODATA2014.test )
15 changes: 15 additions & 0 deletions src/constants/physics/CODATA2014/test/CODATA2014.test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#define CATCH_CONFIG_MAIN

#include "catch.hpp"

#include "constants/physics/CODATA2014.hpp"

using namespace njoy;
using namespace dimwits;

SCENARIO( "Testing CODATA2014 physical constants and uncertainties" ){
auto constants = njoy::constants::physics::CODATA2014;

REQUIRE( 299792458*meter/second == njoy::constants::physics::CODATA2014[constants::physics::speedOfLight] );
REQUIRE( 299792458*meter/second == constants[constants::physics::c] );
}

0 comments on commit 1fb65fa

Please sign in to comment.