1 module example.tests.fail_tests; 2 3 import unit_threaded.all; 4 import core.thread; 5 6 7 class WrongTest: TestCase { 8 override void test() { 9 checkTrue(5 == 3); 10 checkFalse(5 == 5); 11 checkEqual(5, 5); 12 checkNotEqual(5, 3); 13 checkEqual(5, 3); 14 } 15 } 16 17 class OtherWrongTest: TestCase { 18 override void test() { 19 checkTrue(false); 20 } 21 } 22 23 class RightTest: TestCase { 24 override void test() { 25 checkTrue(true); 26 } 27 } 28 29 void testTrue() { 30 checkTrue(true); 31 } 32 33 void testEqualVars() { 34 immutable foo = 4; 35 immutable bar = 6; 36 checkEqual(foo, bar); 37 } 38 39 void someFun() { 40 //not going to be executed as part of the testsuite, 41 //doesn't obey the naming convention 42 assert(0, "Never going to happen"); 43 } 44 45 46 //the tests below should take only 1 second in total if using parallelism 47 //(given enough cores) 48 void testLongRunning1() { 49 Thread.sleep( dur!"seconds"(1)); 50 } 51 52 void testLongRunning2() { 53 Thread.sleep( dur!"seconds"(1)); 54 } 55 56 void testLongRunning3() { 57 Thread.sleep( dur!"seconds"(1)); 58 } 59 60 void testLongRunning4() { 61 Thread.sleep( dur!"seconds"(1)); 62 } 63 64 unittest { 65 assert(false, "unittest block that always fails"); 66 } 67 68 /** 69 * Private stuff to test compile-time scanning doesn't break 70 */ 71 private void randomPrivateFunction() { 72 } 73 74 private class MyPrivateClass { 75 private: 76 int i; 77 } 78 79 class ClassWithPrivateData { 80 private: 81 int i; 82 double d; 83 string s; 84 int[] a; 85 int[int] aa; 86 } 87 88 89 struct StructWithPrivateData { 90 private: 91 int i; 92 double d; 93 string s; 94 int[] a; 95 int[int] aa; 96 }