1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // test ratio_greater 11 12 #include <ratio> 13 14 #include "test_macros.h" 15 16 template <class Rat1, class Rat2, bool result> 17 void test() 18 { 19 static_assert((result == std::ratio_greater<Rat1, Rat2>::value), ""); 20 #if TEST_STD_VER > 14 21 static_assert((result == std::ratio_greater_v<Rat1, Rat2>), ""); 22 #endif 23 } 24 25 int main() 26 { 27 { 28 typedef std::ratio<1, 1> R1; 29 typedef std::ratio<1, 1> R2; 30 test<R1, R2, false>(); 31 } 32 { 33 typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1; 34 typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2; 35 test<R1, R2, false>(); 36 } 37 { 38 typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1; 39 typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2; 40 test<R1, R2, false>(); 41 } 42 { 43 typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1; 44 typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2; 45 test<R1, R2, false>(); 46 } 47 { 48 typedef std::ratio<1, 1> R1; 49 typedef std::ratio<1, -1> R2; 50 test<R1, R2, true>(); 51 } 52 { 53 typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1; 54 typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2; 55 test<R1, R2, true>(); 56 } 57 { 58 typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1; 59 typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2; 60 test<R1, R2, false>(); 61 } 62 { 63 typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1; 64 typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2; 65 test<R1, R2, true>(); 66 } 67 } 68