Lines Matching refs:assert
215 assert(concatAndAdd([1, 2, 3], [4, 5], -1) == [0, 1, 2, 3, 4]);
223 assert(x == 127);
225 assert(x == 127);
232 assert(x == 100);
234 assert(x.isNaN);
242 assert(x < -1); // built-in comparison
243 assert(y > -1); // ProperCompare
302 static assert(is(typeof(x.get()) == ubyte));
303 assert(x.get == 42);
305 static assert(is(typeof(y.get()) == const ubyte));
306 assert(y.get == 42);
319 assert(Checked!short.min == -32768);
320 assert(Checked!(short, WithNaN).min == -32767);
321 assert(Checked!(uint, WithNaN).max == uint.max - 1);
361 assert(a == 42);
363 assert(b == 4242);
389 assert(a == 42);
391 assert(a == 4242);
399 assert(a == 3 && b == 3);
427 assert(a == b);
492 assert(cast(uint) checked(42) == 42);
493 assert(cast(uint) checked!WithNaN(-42) == uint.max);
570 assert(a == uint(-42));
571 assert(MyHook.thereWereErrors);
573 assert(checked!MyHook(uint(-42)) == -42);
574 assert(MyHook.thereWereErrors);
583 assert(checked!MyHook2(uint(-42)) == a);
585 assert(!MyHook.thereWereErrors);
692 assert(format("%04d", checked(15)) == "0015");
693 assert(format("0x%02x", checked(15)) == "0x0f");
798 assert(a > uint(42));
799 assert(MyHook.thereWereErrors);
809 assert(Checked!(uint, MyHook2)(uint(-42)) <= a);
812 assert(!MyHook.thereWereErrors);
813 assert(a <= Checked!(uint, MyHook2)(uint(-42)));
814 assert(MyHook.thereWereErrors);
820 assert(checked(42) <= checked!void(42));
821 assert(checked!void(42) <= checked(42u));
822 assert(checked!void(42) <= checked!(void*)(42u));
863 static assert(is(typeof(-payload) == typeof(payload)));
915 assert(a == -a);
916 assert(MyHook.thereWereErrors);
918 assert(++b == 43);
965 static assert(is(typeof(mixin("payload" ~ op ~ "rhs")) == R));
1041 static assert(0, "Conflict between lhs and rhs hooks," ~
1049 assert(a + 1 == 43);
1050 assert(a + checked(uint(42)) == 84);
1051 assert(checked(42) + checked!void(42u) == 84);
1052 assert(checked!void(42) + checked(42u) == 84);
1063 assert(checked!MyHook(42) + checked(42u) == 84);
1064 assert(checked!void(42) + checked!MyHook(42u) == 84);
1065 assert(MyHook.tally == 2);
1134 assert(1 + checked(1) == 2);
1144 assert(1 + checked!MyHook(1) == 2);
1145 assert(tally == 1);
1148 assert(1 + x1 == 2);
1150 assert(1 + x2 == 2);
1151 assert(tally == 2);
1187 static assert(is(typeof(mixin("payload" ~ op ~ "=rhs")) == T));
1250 assert(MyHook.thereWereErrors);
1254 assert(MyHook.thereWereErrors);
1307 static assert(is(typeof(checked(42)) == Checked!int));
1308 assert(checked(42) == Checked!int(42));
1309 static assert(is(typeof(checked!WithNaN(42)) == Checked!(int, WithNaN)));
1310 assert(checked!WithNaN(42) == Checked!(int, WithNaN)(42));
1318 assert(Checked!(T, void)(ubyte(22)).get == 22);
1328 assert(4 * checked(5L) == 20);
1329 assert(20 / checked(5L) == 4);
1330 assert(2 ^^ checked(3L) == 8);
1331 assert(12 % checked(5L) == 2);
1332 assert((0xff & checked(3L)) == 3);
1333 assert((0xf0 | checked(3L)) == 0xf3);
1334 assert((0xff ^ checked(3L)) == 0xfc);
1364 assert(0);
1384 assert(0);
1390 assert(0);
1416 assert(0);
1448 assert(0);
1470 assert(0);
1476 assert(0);
1488 assert(x1 == 42);
1677 assert(x1 == 42);
1788 assert(x == -42);
1827 assert(x <= -42);
1903 assert(a / b == a * b);
1915 assert(witness == expected, "'" ~ witness ~ "'");
1972 static assert(isFloatingPoint!L && !isFloatingPoint!R);
2026 static assert(isUnsigned!C);
2027 static assert(isUnsigned!L != isUnsigned!R);
2042 assert(opEqualsProper(42, 42));
2043 assert(opEqualsProper(42.0, 42.0));
2044 assert(opEqualsProper(42u, 42));
2045 assert(opEqualsProper(42, 42u));
2046 assert(-1 == 4294967295u);
2047 assert(!opEqualsProper(-1, 4294967295u));
2048 assert(!opEqualsProper(const uint(-1), -1));
2049 assert(!opEqualsProper(uint(-1), -1.0));
2050 assert(3_000_000_000U == -1_294_967_296);
2051 assert(!opEqualsProper(3_000_000_000U, -1_294_967_296));
2057 assert(opCmpProper(42, 42) == 0);
2058 assert(opCmpProper(42, 42.0) == 0);
2059 assert(opCmpProper(41, 42.0) < 0);
2060 assert(opCmpProper(42, 41.0) > 0);
2062 assert(isNaN(opCmpProper(41, double.init)));
2063 assert(opCmpProper(42u, 42) == 0);
2064 assert(opCmpProper(42, 42u) == 0);
2065 assert(opCmpProper(-1, uint(-1)) < 0);
2066 assert(opCmpProper(uint(-1), -1) > 0);
2067 assert(opCmpProper(-1.0, -1) == 0);
2073 assert(x1.get < -1);
2074 assert(x1 > -1);
2152 assert((cast(ubyte) x) == 255);
2154 assert((cast(byte) x) == -128);
2155 assert(cast(short) x == -422);
2156 assert(cast(bool) x);
2158 assert(x != true);
2159 assert(x != false);
2205 assert(!(x < 0) && !(x > 0) && !(x == 0));
2207 assert(x > 0 && !(x < 0) && !(x == 0));
2250 static assert(defaultValue!T == T.max);
2265 assert(x.isNaN);
2267 assert(!x.isNaN);
2270 assert(!x.isNaN);
2277 assert(y.isNaN);
2314 assert((x + 1).isNaN);
2316 assert(!(x + 1).isNaN);
2352 assert((1 + x).isNaN);
2354 assert(!(1 + x).isNaN);
2390 assert(x.isNaN);
2393 assert(!x.isNaN);
2395 assert(x.isNaN);
2403 assert(x1.isNaN);
2404 assert(x1.get == int.min);
2405 assert(x1 != x1);
2406 assert(!(x1 < x1));
2407 assert(!(x1 > x1));
2408 assert(!(x1 == x1));
2410 assert(x1.isNaN);
2411 assert(x1.get == int.min);
2413 assert(x1.isNaN);
2414 assert(x1.get == int.min);
2416 assert(!x1.isNaN);
2417 assert(x1 == x1);
2418 assert(x1 <= x1);
2419 assert(x1 >= x1);
2420 static assert(x1.min == int.min + 1);
2442 assert(x1.isNaN);
2444 assert(!x1.isNaN);
2446 assert(x1.isNaN);
2454 assert(x1.isNaN);
2455 assert(x1.get == int.min);
2456 assert(x1 != x1);
2457 assert(!(x1 < x1));
2458 assert(!(x1 > x1));
2459 assert(!(x1 == x1));
2460 assert(x1.get == int.min);
2462 assert(!x2.isNaN);
2463 assert(x2 == x2);
2464 assert(x2 <= x2);
2465 assert(x2 >= x2);
2466 static assert(x2.min == T.min + 1);
2475 assert(x1.get == T.min);
2476 assert(x1 != x1);
2477 assert(!(x1 < x1));
2478 assert(!(x1 > x1));
2479 assert(!(x1 == x1));
2481 assert(x1.get == T.min);
2483 assert(x1.get == T.min);
2485 assert(x1 == x1);
2486 assert(x1 <= x1);
2487 assert(x1 >= x1);
2488 static assert(x1.min == T.min + 1);
2498 assert(x1 != x1);
2500 assert(x1 < 1u);
2546 assert(x == short.max);
2548 assert(x == short.min);
2576 static assert(x == "-" || x == "++" || x == "--");
2597 static assert(false);
2602 assert(checked!Saturate(int.max) + 1 == int.max);
2603 assert(checked!Saturate(100) ^^ 10 == int.max);
2604 assert(checked!Saturate(-100) ^^ 10 == int.max);
2605 assert(checked!Saturate(100) / 0 == int.max);
2606 assert(checked!Saturate(100) << -1 == 0);
2607 assert(checked!Saturate(100) << 33 == int.max);
2608 assert(checked!Saturate(100) >> -1 == int.max);
2609 assert(checked!Saturate(100) >> 33 == 0);
2618 assert(x == int.max);
2620 assert(x == int.max - 1);
2622 assert(-x == int.max);
2624 assert(x == int.min);
2625 assert(x * -2 == int.max);
2687 static assert(isUnsigned!C);
2688 static assert(isUnsigned!L != isUnsigned!R);
2711 static assert(isUnsigned!C);
2712 static assert(isUnsigned!L != isUnsigned!R);
2786 else static assert(0, x);
2790 static assert(isUnsigned!Result);
2791 static assert(isUnsigned!L != isUnsigned!R);
2843 else static assert(0, x);
2845 debug assert(false);
2855 assert(opChecked!"+"(const short(1), short(1), overflow) == 2 && !overflow);
2856 assert(opChecked!"+"(1, 1, overflow) == 2 && !overflow);
2857 assert(opChecked!"+"(1, 1u, overflow) == 2 && !overflow);
2858 assert(opChecked!"+"(-1, 1u, overflow) == 0 && !overflow);
2859 assert(opChecked!"+"(1u, -1, overflow) == 0 && !overflow);
2866 assert(opChecked!"-"(1, 1, overflow) == 0 && !overflow);
2867 assert(opChecked!"-"(1, 1u, overflow) == 0 && !overflow);
2868 assert(opChecked!"-"(1u, -1, overflow) == 2 && !overflow);
2869 assert(opChecked!"-"(-1, 1u, overflow) == 0 && overflow);
2875 assert(opChecked!"*"(2, 3, overflow) == 6 && !overflow);
2876 assert(opChecked!"*"(2, 3u, overflow) == 6 && !overflow);
2877 assert(opChecked!"*"(1u, -1, overflow) == 0 && overflow);
2884 assert(opChecked!"/"(6, 3, overflow) == 2 && !overflow);
2885 assert(opChecked!"/"(6, 3, overflow) == 2 && !overflow);
2886 assert(opChecked!"/"(6u, 3, overflow) == 2 && !overflow);
2887 assert(opChecked!"/"(6, 3u, overflow) == 2 && !overflow);
2888 assert(opChecked!"/"(11, 0, overflow) == 0 && overflow);
2890 assert(opChecked!"/"(6u, 0, overflow) == 0 && overflow);
2892 assert(opChecked!"/"(-6, 2u, overflow) == 0 && overflow);
2894 assert(opChecked!"/"(-6, 0u, overflow) == 0 && overflow);
2896 assert(opChecked!"cmp"(0u, -6, overflow) == 1 && overflow);
2898 assert(opChecked!"|"(1, 2, overflow) == 3 && !overflow);
2949 assert((b > 1 || b < -1) && rhs > 1);
2958 assert(e > 1);
2984 assert(opChecked!"^^"(T(0), 0, overflow) == 1);
2985 assert(opChecked!"^^"(-2, T(0), overflow) == 1);
2986 assert(opChecked!"^^"(-2, T(1), overflow) == -2);
2987 assert(opChecked!"^^"(-1, -1, overflow) == -1);
2988 assert(opChecked!"^^"(-2, 1, overflow) == -2);
2989 assert(opChecked!"^^"(-2, -1, overflow) == 0);
2990 assert(opChecked!"^^"(-2, 4u, overflow) == 16);
2991 assert(!overflow);
2992 assert(opChecked!"^^"(-2, 3u, overflow) == 0);
2993 assert(overflow);
2995 assert(opChecked!"^^"(3, 64u, overflow) == 0);
2996 assert(overflow);
3000 assert(opChecked!"^^"(x, i, overflow) == x ^^ i);
3001 assert(!overflow);
3003 assert(opChecked!"^^"(x, e, overflow) == x ^^ e);
3004 assert(overflow);
3051 assert(x + y == 184);
3052 assert(x + 100 == 142);
3053 assert(y - x == 100);
3054 assert(200 - x == 158);
3055 assert(y * x == 142 * 42);
3056 assert(x / 1 == 42);
3057 assert(x % 20 == 2);
3060 assert(x1 + 0 == 42);
3061 assert(x1 + false == 42);
3062 assert(is(typeof(x1 + 0.5) == double));
3063 assert(x1 + 0.5 == 42.5);
3064 assert(x1.hook.calls == 0);
3065 assert(x1 + int.max == int.max + 42);
3066 assert(x1.hook.calls == 1);
3067 assert(x1 * 2 == 84);
3068 assert(x1.hook.calls == 1);
3069 assert(x1 / 2 == 21);
3070 assert(x1.hook.calls == 1);
3071 assert(x1 % 20 == 2);
3072 assert(x1.hook.calls == 1);
3073 assert(x1 << 2 == 42 << 2);
3074 assert(x1.hook.calls == 1);
3075 assert(x1 << 42 == x1.get << x1.get);
3076 assert(x1.hook.calls == 2);
3078 assert(x1 - 1 == int.max);
3079 assert(x1.hook.calls == 3);
3082 assert(x2 + 1 == 43);
3083 assert(x2.hook.calls == 1);
3086 assert(x3 + 1 == 43);
3087 assert(x3.hook.calls == 0);
3088 assert(x3 - 1 == 41);
3089 assert(x3.hook.calls == 0);
3090 assert(x3 + (-42) == 0);
3091 assert(x3.hook.calls == 0);
3092 assert(x3 - (-42) == 84);
3093 assert(x3.hook.calls == 0);
3094 assert(x3 * 2 == 84);
3095 assert(x3.hook.calls == 0);
3096 assert(x3 * -2 == -84);
3097 assert(x3.hook.calls == 1);
3098 assert(x3 / 2 == 21);
3099 assert(x3.hook.calls == 1);
3100 assert(x3 / -2 == 0);
3101 assert(x3.hook.calls == 2);
3102 assert(x3 ^^ 2 == 42 * 42);
3103 assert(x3.hook.calls == 2);
3106 assert(x4 + 1 == 43);
3107 assert(x4.hook.calls == 0);
3108 assert(x4 + 1u == 43);
3109 assert(x4.hook.calls == 0);
3110 assert(x4 - 1 == 41);
3111 assert(x4.hook.calls == 0);
3112 assert(x4 * 2 == 84);
3113 assert(x4.hook.calls == 0);
3115 assert(x4 + 2u == 0);
3116 assert(x4.hook.calls == 0);
3117 assert(x4 * 2u == -4);
3118 assert(x4.hook.calls == 1);
3121 assert(x5 ^^ 0 == 1);
3122 assert(x5 ^^ 1 == 3);
3123 assert(x5 ^^ 2 == 9);
3124 assert(x5 ^^ 3 == 27);
3125 assert(x5 ^^ 4 == 81);
3126 assert(x5 ^^ 5 == 81 * 3);
3127 assert(x5 ^^ 6 == 81 * 9);
3134 assert(1 + x1 == 43);
3135 assert(true + x1 == 43);
3136 assert(0.5 + x1 == 42.5);
3138 assert(x1 + x2 == 84);
3139 assert(x2 + x1 == 84);
3146 assert((x1 += 2) == 5);
3148 assert(x1.hook.calls == 1);
3150 assert(x1.hook.calls == 2);
3153 assert((x2 += 2) == 5);
3154 assert(x2.hook.calls == 0);
3155 assert((x2 += ushort.max) == cast(ushort) (ushort(5) + ushort.max));
3156 assert(x2.hook.calls == 1);
3160 assert(x3.hook.calls == 1);
3168 assert(x.get == 42);
3170 assert(x.get == 42);
3172 assert(x.get == 43);
3174 assert(x.get == 44);
3179 static assert(!is(typeof(Checked!(short, void)(ushort(42)))));
3180 static assert(!is(typeof(Checked!(int, void)(long(42)))));
3181 static assert(!is(typeof(Checked!(int, void)(ulong(42)))));
3182 assert(Checked!(short, void)(short(42)).get == 42);
3183 assert(Checked!(int, void)(ushort(42)).get == 42);
3189 static assert(is(typeof(cast(float) Checked!(int, void)(42)) == float));
3190 assert(cast(float) Checked!(int, void)(42) == 42);
3192 assert(is(typeof(cast(long) Checked!(int, void)(42)) == long));
3193 assert(cast(long) Checked!(int, void)(42) == 42);
3194 static assert(is(typeof(cast(long) Checked!(uint, void)(42u)) == long));
3195 assert(cast(long) Checked!(uint, void)(42u) == 42);
3198 if (x) {} else assert(0);
3200 if (x) assert(0);
3212 assert(cast(int) y == 42);
3213 assert(cast(uint) y == 42);
3214 assert(y.hook.calls == 2);
3226 assert(cast(ushort) x1 == 100);
3227 assert(cast(short) x1 == 100);
3228 assert(cast(float) x1 == 100);
3229 assert(cast(double) x1 == 100);
3230 assert(cast(real) x1 == 100);
3231 assert(x1.hook.calls == 0);
3232 assert(cast(int) x1 == 100);
3233 assert(x1.hook.calls == 0);
3235 assert(cast(int) x1 == 42);
3236 assert(x1.hook.calls == 1);
3239 assert(cast(short) x2 == -100);
3240 assert(cast(ushort) x2 == 42);
3241 assert(cast(uint) x2 == 42);
3242 assert(cast(ulong) x2 == 42);
3243 assert(x2.hook.calls == 3);
3249 assert(Checked!(int, void)(42) == 42L);
3250 assert(42UL == Checked!(int, void)(42));
3262 assert(x1 != Checked!(long, Hook1)(100));
3263 assert(x1.hook.calls == 1);
3264 assert(x1 != 100u);
3265 assert(x1.hook.calls == 2);
3277 assert(x2 != x1);
3279 assert(Checked!(uint, void)(100u) != x2);
3281 assert(Checked!(uint, void)(100u) == Checked!(int, void*)(100));
3282 assert(x2.hook.calls == 0);
3283 assert(x2 != -100);
3284 assert(x2.hook.calls == 1);
3285 assert(x2 != cast(uint) -100);
3286 assert(x2.hook.calls == 2);
3288 assert(x2 != cast(uint) 100);
3289 assert(x2.hook.calls == 3);
3293 assert(x3 != 100);
3295 assert(x3 != -1);
3297 assert(x2 != x3);
3304 assert(x <= x);
3305 assert(x < 45);
3306 assert(x < 45u);
3307 assert(x > -45);
3308 assert(x < 44.2);
3309 assert(x > -44.2);
3310 assert(!(x < double.init));
3311 assert(!(x > double.init));
3312 assert(!(x <= double.init));
3313 assert(!(x >= double.init));
3325 assert(!(x1 < 43u));
3326 assert(!(43u < x1));
3327 assert(x1.hook.calls == 2);
3339 assert(x2 < 43u);
3340 assert(43u > x2);
3341 assert(x2.hook.calls == 2);
3343 assert(x2 > 41u);
3346 assert(x3 > 41);
3347 assert(x3 > -41);
3354 assert(x == +x);
3355 static assert(is(typeof(-x) == typeof(x)));
3356 assert(-x == Checked!(int, void)(-42));
3357 static assert(is(typeof(~x) == typeof(x)));
3358 assert(~x == Checked!(int, void)(~42));
3359 assert(++x == 43);
3360 assert(--x == 42);
3377 assert(is(typeof(-x1) == typeof(x1)));
3378 assert(-x1 == Checked!(int, Hook1)(42));
3379 assert(is(typeof(~x1) == typeof(x1)));
3380 assert(~x1 == Checked!(int, Hook1)(43));
3381 assert(x1.hook.calls == 2);
3398 assert(++x2 == 99);
3399 assert(x2 == 99);
3400 assert(--x2 == 100);
3401 assert(x2 == 100);
3404 assert(++x3 == int.max);
3405 assert(x3.hook.calls == 0);
3406 assert(++x3 == int.min);
3407 assert(x3.hook.calls == 1);
3408 assert(-x3 == int.min);
3409 assert(x3.hook.calls == 2);
3412 assert(--x3 == int.min);
3413 assert(x3.hook.calls == 2);
3414 assert(--x3 == int.max);
3415 assert(x3.hook.calls == 3);
3422 assert(x == x);
3423 assert(x == +x);
3424 assert(x == -x);
3426 assert(x == 1);
3428 assert(x == 2);
3431 assert(x == 42);
3434 assert(x == _short);
3437 assert(x == _ushort);
3438 assert(x == 44.0);
3439 assert(x != 44.1);
3440 assert(x < 45);
3441 assert(x < 44.2);
3442 assert(x > -45);
3443 assert(x > -44.2);
3445 assert(cast(long) x == 44);
3446 assert(cast(short) x == 44);
3449 assert(y <= y);
3450 assert(y == 0);
3451 assert(y < x);
3453 assert(x > y);
3461 assert(a == cint(3));
3466 assert(a == cint(17));
3472 assert(checked(42).toHash() == checked(42).toHash());
3473 assert(checked(12).toHash() != checked(19).toHash());
3493 assert(a.toHash() == b.toHash());
3495 assert(checked!Hook1(12).toHash() != checked!Hook1(13).toHash());
3517 assert((() nothrow @safe => x.toHash() == x.toHash())());
3519 assert(x.toHash() == x.toHash());
3520 assert(x.toHash() != y.toHash());
3521 assert(checked!Hook1(1901).toHash() != x.toHash());
3527 assert(z.toHash() == t.toHash());
3528 assert(z.toHash() != x.toHash());
3529 assert(z.toHash() != w.toHash());
3534 assert(checked!Hook1(c).toHash() != checked!Hook2(c));
3535 assert(checked!Hook1(c).toHash() != checked!Hook1(d));
3544 assert(checked!Hook3(12).toHash() != checked!Hook3(13).toHash());
3545 assert(checked!Hook3(13).toHash() == checked!Hook3(13).toHash());
3552 assert(x1.toHash() == x2.toHash());
3553 assert(x1.toHash() != x3.toHash());
3554 assert(x2.toHash() != x3.toHash());
3562 assert(shared0.toHash() == hashOf(shared0));
3563 assert(shared1.toHash() == hashOf(shared1));
3564 assert(shared2.toHash() == hashOf(shared2));
3565 assert(shared3.toHash() == hashOf(shared3));
3584 assert(aa[var] == 100);
3590 assert(bb[var2] == 100);