1 module dud.semver.checktest1; 2 3 @safe pure private: 4 import std.exception : assertThrown, assertNotThrown; 5 import std.stdio; 6 import std.format : format; 7 8 import dud.semver.checks; 9 import dud.semver.parse; 10 import dud.semver.semver; 11 import dud.semver.versionrange; 12 import dud.semver.versionunion; 13 import dud.semver.exception; 14 15 import dud.semver.testdata; 16 17 unittest { // VersionUnion, VersionUnion 18 assert( allowsAll(vu1, vu1)); 19 assert(!allowsAll(vu1, vu2)); 20 assert(!allowsAll(vu1, vu3)); 21 assert(!allowsAll(vu1, vu4)); 22 assert(!allowsAll(vu1, vu5)); 23 24 assert( allowsAll(vu2, vu1)); 25 assert( allowsAll(vu2, vu2)); 26 assert(!allowsAll(vu2, vu3)); 27 assert( allowsAll(vu2, vu4)); 28 assert(!allowsAll(vu2, vu5)); 29 30 assert(!allowsAll(vu3, vu1)); 31 assert(!allowsAll(vu3, vu2)); 32 assert( allowsAll(vu3, vu3)); 33 assert( allowsAll(vu3, vu4)); 34 assert(!allowsAll(vu3, vu5)); 35 36 assert(!allowsAll(vu4, vu1)); 37 assert(!allowsAll(vu4, vu2)); 38 assert(!allowsAll(vu4, vu3)); 39 assert( allowsAll(vu4, vu4)); 40 assert(!allowsAll(vu4, vu5)); 41 42 assert(!allowsAll(vu5, vu1)); 43 assert(!allowsAll(vu5, vu2)); 44 assert(!allowsAll(vu5, vu3)); 45 assert(!allowsAll(vu5, vu4)); 46 assert( allowsAll(vu5, vu5)); 47 } 48 49 unittest { // VersionUnion, VersionRange 50 assert( allowsAll(vu1, vr1)); 51 assert(!allowsAll(vu1, vr2)); 52 assert(!allowsAll(vu1, vr3)); 53 assert( allowsAll(vu1, vr4)); 54 assert(!allowsAll(vu1, vr5)); 55 56 assert( allowsAll(vu2, vr1)); 57 assert( allowsAll(vu2, vr2)); 58 assert(!allowsAll(vu2, vr3)); 59 assert( allowsAll(vu2, vr4)); 60 assert(!allowsAll(vu2, vr5)); 61 62 assert(!allowsAll(vu3, vr1)); 63 assert( allowsAll(vu3, vr2)); 64 assert( allowsAll(vu3, vr3)); 65 assert( allowsAll(vu3, vr4)); 66 assert(!allowsAll(vu3, vr5)); 67 68 assert(!allowsAll(vu4, vr1)); 69 assert( allowsAll(vu4, vr2)); 70 assert(!allowsAll(vu4, vr3)); 71 assert( allowsAll(vu4, vr4)); 72 assert(!allowsAll(vu4, vr5)); 73 74 assert( allowsAll(vu5, vr1)); 75 assert(!allowsAll(vu5, vr2)); 76 assert(!allowsAll(vu5, vr3)); 77 assert(!allowsAll(vu5, vr4)); 78 assert( allowsAll(vu5, vr5)); 79 } 80 81 unittest { // VersionUnion, SemVer 82 assert(!allowsAll(vu1, v1)); 83 assert( allowsAll(vu1, v2)); 84 assert(!allowsAll(vu1, v3)); 85 assert(!allowsAll(vu1, v4)); 86 87 assert(!allowsAll(vu2, v1)); 88 assert( allowsAll(vu2, v2)); 89 assert(!allowsAll(vu2, v3)); 90 assert( allowsAll(vu2, v4)); 91 92 assert(!allowsAll(vu3, v1)); 93 assert(!allowsAll(vu3, v2)); 94 assert( allowsAll(vu3, v3)); 95 assert( allowsAll(vu3, v4)); 96 97 assert(!allowsAll(vu4, v1)); 98 assert(!allowsAll(vu4, v2)); 99 assert(!allowsAll(vu4, v3)); 100 assert( allowsAll(vu4, v4)); 101 102 assert(!allowsAll(vu5, v1)); 103 assert( allowsAll(vu5, v2)); 104 assert(!allowsAll(vu5, v3)); 105 assert(!allowsAll(vu5, v4)); 106 } 107 108 unittest { // VersionRange, VersionUnion 109 assert(!allowsAll(vr1, vu1)); 110 assert(!allowsAll(vr1, vu2)); 111 assert(!allowsAll(vr1, vu3)); 112 assert(!allowsAll(vr1, vu4)); 113 assert(!allowsAll(vr1, vu5)); 114 115 assert(!allowsAll(vr2, vu1)); 116 assert(!allowsAll(vr2, vu2)); 117 assert(!allowsAll(vr2, vu3)); 118 assert( allowsAll(vr2, vu4)); 119 assert(!allowsAll(vr2, vu5)); 120 121 assert(!allowsAll(vr3, vu1)); 122 assert(!allowsAll(vr3, vu2)); 123 assert( allowsAll(vr3, vu3)); 124 assert( allowsAll(vr3, vu4)); 125 assert(!allowsAll(vr3, vu5)); 126 127 assert(!allowsAll(vr4, vu1)); 128 assert(!allowsAll(vr4, vu2)); 129 assert(!allowsAll(vr4, vu3)); 130 assert(!allowsAll(vr4, vu4)); 131 assert(!allowsAll(vr4, vu5)); 132 133 assert(!allowsAll(vr5, vu1)); 134 assert(!allowsAll(vr5, vu2)); 135 assert(!allowsAll(vr5, vu3)); 136 assert(!allowsAll(vr5, vu4)); 137 assert(!allowsAll(vr5, vu5)); 138 } 139 140 unittest { // VersionRange, VersionRange 141 assert( allowsAll(vr1, vr1)); 142 assert(!allowsAll(vr1, vr2)); 143 assert(!allowsAll(vr1, vr3)); 144 assert(!allowsAll(vr1, vr4)); 145 assert(!allowsAll(vr1, vr5)); 146 147 assert(!allowsAll(vr2, vr1)); 148 assert( allowsAll(vr2, vr2)); 149 assert(!allowsAll(vr2, vr3)); 150 assert( allowsAll(vr2, vr4)); 151 assert(!allowsAll(vr2, vr5)); 152 153 assert(!allowsAll(vr3, vr1)); 154 assert( allowsAll(vr3, vr2)); 155 assert( allowsAll(vr3, vr3)); 156 assert( allowsAll(vr3, vr4)); 157 assert(!allowsAll(vr3, vr5)); 158 159 assert(!allowsAll(vr4, vr1)); 160 assert(!allowsAll(vr4, vr2)); 161 assert(!allowsAll(vr4, vr3)); 162 assert( allowsAll(vr4, vr4)); 163 assert(!allowsAll(vr4, vr5)); 164 165 assert(!allowsAll(vr5, vr1)); 166 assert(!allowsAll(vr5, vr2)); 167 assert(!allowsAll(vr5, vr3)); 168 assert(!allowsAll(vr5, vr4)); 169 assert( allowsAll(vr5, vr5)); 170 } 171 172 unittest { // VersionRange, SemVer 173 assert(!allowsAll(vr1, v1)); 174 assert( allowsAll(vr1, v2)); 175 assert(!allowsAll(vr1, v3)); 176 assert(!allowsAll(vr1, v4)); 177 178 assert(!allowsAll(vr2, v1)); 179 assert(!allowsAll(vr2, v2)); 180 assert(!allowsAll(vr2, v3)); 181 assert( allowsAll(vr2, v4)); 182 183 assert(!allowsAll(vr3, v1)); 184 assert(!allowsAll(vr3, v2)); 185 assert( allowsAll(vr3, v3)); 186 assert( allowsAll(vr3, v4)); 187 188 assert(!allowsAll(vr4, v1)); 189 assert(!allowsAll(vr4, v2)); 190 assert(!allowsAll(vr4, v3)); 191 assert(!allowsAll(vr4, v4)); 192 193 assert(!allowsAll(vr5, v1)); 194 assert(!allowsAll(vr5, v2)); 195 assert(!allowsAll(vr5, v3)); 196 assert(!allowsAll(vr5, v4)); 197 }