op_equal.pass.cpp revision bc8d3f97eb5c958007f2713238472e0c1c8fe02c
1//===----------------------------------------------------------------------===//
2//
3// ��������������������The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <chrono>
11
12// time_point
13
14// template <class Clock, class Duration1, class Duration2>
15//   bool
16//   operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
17
18// template <class Clock, class Duration1, class Duration2>
19//   bool
20//   operator!=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
21
22#include <chrono>
23#include <cassert>
24
25int main()
26{
27    typedef std::chrono::system_clock Clock;
28    typedef std::chrono::milliseconds Duration1;
29    typedef std::chrono::microseconds Duration2;
30    typedef std::chrono::time_point<Clock, Duration1> T1;
31    typedef std::chrono::time_point<Clock, Duration2> T2;
32
33    {
34    T1 t1(Duration1(3));
35    T1 t2(Duration1(3));
36    assert( (t1 == t2));
37    assert(!(t1 != t2));
38    }
39    {
40    T1 t1(Duration1(3));
41    T1 t2(Duration1(4));
42    assert(!(t1 == t2));
43    assert( (t1 != t2));
44    }
45    {
46    T1 t1(Duration1(3));
47    T2 t2(Duration2(3000));
48    assert( (t1 == t2));
49    assert(!(t1 != t2));
50    }
51    {
52    T1 t1(Duration1(3));
53    T2 t2(Duration2(3001));
54    assert(!(t1 == t2));
55    assert( (t1 != t2));
56    }
57}
58