1 //          Copyright Mario Kröplin 2016.
2 // Distributed under the Boost Software License, Version 1.0.
3 //    (See accompanying file LICENSE_1_0.txt or copy at
4 //          http://www.boost.org/LICENSE_1_0.txt)
5 
6 module dunit.ng.assertion;
7 
8 public import dunit.assertion : assertTrue, assertFalse, assertEmpty, assertNotEmpty, assertNull, assertNotNull,
9     assertAll, expectThrows, fail,
10     assertGreaterThan, assertGreaterThanOrEqual, assertLessThan, assertLessThanOrEqual,
11     assertIn, assertNotIn, assertOp,
12     assertEventually;
13 
14 /**
15  * Asserts that the values are equal.
16  * Throws: AssertException otherwise
17  */
18 void assertEquals(T, U)(T actual, U expected, lazy string msg = null,
19         string file = __FILE__,
20         size_t line = __LINE__)
21 {
22     import dunit.assertion : assertEquals;
23 
24     assertEquals(expected, actual, msg, file, line);
25 }
26 
27 /**
28  * Asserts that the arrays are equal.
29  * Throws: AssertException otherwise
30  */
31 void assertArrayEquals(T, U)(in T[] actual, in U[] expected, lazy string msg = null,
32         string file = __FILE__,
33         size_t line = __LINE__)
34 {
35     import dunit.assertion : assertArrayEquals;
36 
37     assertArrayEquals(expected, actual, msg, file, line);
38 }
39 
40 /**
41  * Asserts that the associative arrays are equal.
42  * Throws: AssertException otherwise
43  */
44 void assertArrayEquals(T, U, V)(in T[V] actual, in U[V] expected, lazy string msg = null,
45         string file = __FILE__,
46         size_t line = __LINE__)
47 {
48     import dunit.assertion : assertArrayEquals;
49 
50     assertArrayEquals(expected, actual, msg, file, line);
51 }
52 
53 /**
54  * Asserts that the ranges are equal.
55  * Throws: AssertException otherwise
56  */
57 void assertRangeEquals(R1, R2)(R1 actual, R2 expected, lazy string msg = null,
58         string file = __FILE__,
59         size_t line = __LINE__)
60 {
61     import dunit.assertion : assertRangeEquals;
62 
63     assertRangeEquals(expected, actual, msg, file, line);
64 }
65 
66 /**
67  * Asserts that the values are the same.
68  * Throws: AssertException otherwise
69  */
70 void assertSame(T, U)(T actual, U expected, lazy string msg = null,
71         string file = __FILE__,
72         size_t line = __LINE__)
73 {
74     import dunit.assertion : assertSame;
75 
76     assertSame(expected, actual, msg, file, line);
77 }
78 
79 /**
80  * Asserts that the values are not the same.
81  * Throws: AssertException otherwise
82  */
83 void assertNotSame(T, U)(T actual, U expected, lazy string msg = null,
84         string file = __FILE__,
85         size_t line = __LINE__)
86 {
87     import dunit.assertion : assertNotSame;
88 
89     assertNotSame(expected, actual, msg, file, line);
90 }