diff --git a/integration_tests/CMakeLists.txt b/integration_tests/CMakeLists.txt index 4e0b1e5..ba05406 100644 --- a/integration_tests/CMakeLists.txt +++ b/integration_tests/CMakeLists.txt @@ -224,3 +224,4 @@ RUN(NAME nbody_01.cpp LABELS gcc llvm NOFAST) RUN(NAME nbody_02.cpp LABELS gcc llvm NOFAST) RUN(NAME enum_01.cpp LABELS gcc llvm NOFAST) +RUN(NAME enum_02.cpp LABELS gcc llvm NOFAST) diff --git a/integration_tests/enum_02.cpp b/integration_tests/enum_02.cpp new file mode 100644 index 0000000..ed7ded4 --- /dev/null +++ b/integration_tests/enum_02.cpp @@ -0,0 +1,47 @@ +#include + +enum MolecularMass { + water = 18, + methane = 16, + ammonia = 17, + oxygen = 16 +}; + +enum RelativeCharge { + proton = 1, + electron = -1, + neutron = 0 +}; + +void test_mm() { + std::cout << methane << " " << oxygen << std::endl; + if( methane != oxygen ) { + exit(2); + } + + std::cout << ammonia - methane << std::endl; + if( ammonia - methane != 1 ) { + exit(2); + } + + std::cout << water << " " << oxygen + 2 << std::endl; + if( water != oxygen + 2 ) { + exit(2); + } +} + +void test_rc() { + std::cout << proton << " " << electron << " " << neutron << std::endl; + if( proton + electron != neutron ) { + exit(2); + } +} + +int main() { + +test_mm(); +test_rc(); + +return 0; + +}