Lines Matching refs:assert

208     assert(concatAndAdd([1, 2, 3], [4, 5], -1) == [0, 1, 2, 3, 4]);
250 static assert(is(typeof(x.get()) == ubyte));
251 assert(x.get == 42);
253 static assert(is(typeof(y.get()) == const ubyte));
254 assert(y.get == 42);
267 assert(Checked!short.min == -32768);
268 assert(Checked!(short, WithNaN).min == -32767);
269 assert(Checked!(uint, WithNaN).max == uint.max - 1);
301 assert(a == 42);
303 assert(b == 4242);
321 assert(a == 42);
323 assert(a == 4242);
384 assert(cast(uint) checked(42) == 42);
385 assert(cast(uint) checked!WithNaN(-42) == uint.max);
455 assert(a == uint(-42));
456 assert(MyHook.thereWereErrors);
458 assert(checked!MyHook(uint(-42)) == -42);
459 assert(MyHook.thereWereErrors);
468 assert(checked!MyHook2(uint(-42)) == a);
470 assert(!MyHook.thereWereErrors);
559 assert(a > uint(42));
560 assert(MyHook.thereWereErrors);
570 assert(Checked!(uint, MyHook2)(uint(-42)) <= a);
573 assert(!MyHook.thereWereErrors);
574 assert(a <= Checked!(uint, MyHook2)(uint(-42)));
575 assert(MyHook.thereWereErrors);
581 assert(checked(42) <= checked!void(42));
582 assert(checked!void(42) <= checked(42u));
583 assert(checked!void(42) <= checked!(void*)(42u));
618 static assert(is(typeof(-payload) == typeof(payload)));
670 assert(a == -a);
671 assert(MyHook.thereWereErrors);
673 assert(++b == 43);
709 static assert(is(typeof(mixin("payload" ~ op ~ "rhs")) == R));
785 static assert(0, "Conflict between lhs and rhs hooks," ~
793 assert(a + 1 == 43);
794 assert(a + checked(uint(42)) == 84);
795 assert(checked(42) + checked!void(42u) == 84);
796 assert(checked!void(42) + checked(42u) == 84);
807 assert(checked!MyHook(42) + checked(42u) == 84);
808 assert(checked!void(42) + checked!MyHook(42u) == 84);
809 assert(MyHook.tally == 2);
870 assert(1 + checked(1) == 2);
880 assert(1 + checked!MyHook(1) == 2);
881 assert(tally == 1);
884 assert(1 + x1 == 2);
886 assert(1 + x2 == 2);
887 assert(tally == 2);
919 static assert(is(typeof(mixin("payload" ~ op ~ "=rhs")) == T));
975 assert(MyHook.thereWereErrors);
979 assert(MyHook.thereWereErrors);
999 static assert(is(typeof(checked(42)) == Checked!int));
1000 assert(checked(42) == Checked!int(42));
1001 static assert(is(typeof(checked!WithNaN(42)) == Checked!(int, WithNaN)));
1002 assert(checked!WithNaN(42) == Checked!(int, WithNaN)(42));
1010 assert(Checked!(T, void)(ubyte(22)).get == 22);
1044 assert(0);
1064 assert(0);
1070 assert(0);
1096 assert(0);
1128 assert(0);
1150 assert(0);
1156 assert(0);
1167 assert(x1 == 42);
1340 assert(x1 == 42);
1451 assert(x == -42);
1490 assert(x <= -42);
1582 static assert(isFloatingPoint!L && !isFloatingPoint!R);
1636 static assert(isUnsigned!C);
1637 static assert(isUnsigned!L != isUnsigned!R);
1652 assert(opEqualsProper(42, 42));
1653 assert(opEqualsProper(42.0, 42.0));
1654 assert(opEqualsProper(42u, 42));
1655 assert(opEqualsProper(42, 42u));
1656 assert(-1 == 4294967295u);
1657 assert(!opEqualsProper(-1, 4294967295u));
1658 assert(!opEqualsProper(const uint(-1), -1));
1659 assert(!opEqualsProper(uint(-1), -1.0));
1660 assert(3_000_000_000U == -1_294_967_296);
1661 assert(!opEqualsProper(3_000_000_000U, -1_294_967_296));
1667 assert(opCmpProper(42, 42) == 0);
1668 assert(opCmpProper(42, 42.0) == 0);
1669 assert(opCmpProper(41, 42.0) < 0);
1670 assert(opCmpProper(42, 41.0) > 0);
1672 assert(isNaN(opCmpProper(41, double.init)));
1673 assert(opCmpProper(42u, 42) == 0);
1674 assert(opCmpProper(42, 42u) == 0);
1675 assert(opCmpProper(-1, uint(-1)) < 0);
1676 assert(opCmpProper(uint(-1), -1) > 0);
1677 assert(opCmpProper(-1.0, -1) == 0);
1683 assert(x1.get < -1);
1684 assert(x1 > -1);
1762 assert((cast(ubyte) x) == 255);
1764 assert((cast(byte) x) == -128);
1765 assert(cast(short) x == -422);
1766 assert(cast(bool) x);
1768 assert(x != true);
1769 assert(x != false);
1815 assert(!(x < 0) && !(x > 0) && !(x == 0));
1817 assert(x > 0 && !(x < 0) && !(x == 0));
1860 static assert(defaultValue!T == T.max);
1875 assert(x.isNaN);
1877 assert(!x.isNaN);
1880 assert(!x.isNaN);
1887 assert(y.isNaN);
1924 assert((x + 1).isNaN);
1926 assert(!(x + 1).isNaN);
1962 assert((1 + x).isNaN);
1964 assert(!(1 + x).isNaN);
2000 assert(x.isNaN);
2003 assert(!x.isNaN);
2005 assert(x.isNaN);
2013 assert(x1.isNaN);
2014 assert(x1.get == int.min);
2015 assert(x1 != x1);
2016 assert(!(x1 < x1));
2017 assert(!(x1 > x1));
2018 assert(!(x1 == x1));
2020 assert(x1.isNaN);
2021 assert(x1.get == int.min);
2023 assert(x1.isNaN);
2024 assert(x1.get == int.min);
2026 assert(!x1.isNaN);
2027 assert(x1 == x1);
2028 assert(x1 <= x1);
2029 assert(x1 >= x1);
2030 static assert(x1.min == int.min + 1);
2050 assert(x1.isNaN);
2052 assert(!x1.isNaN);
2054 assert(x1.isNaN);
2062 assert(x1.isNaN);
2063 assert(x1.get == int.min);
2064 assert(x1 != x1);
2065 assert(!(x1 < x1));
2066 assert(!(x1 > x1));
2067 assert(!(x1 == x1));
2068 assert(x1.get == int.min);
2070 assert(!x2.isNaN);
2071 assert(x2 == x2);
2072 assert(x2 <= x2);
2073 assert(x2 >= x2);
2074 static assert(x2.min == T.min + 1);
2083 assert(x1.get == T.min);
2084 assert(x1 != x1);
2085 assert(!(x1 < x1));
2086 assert(!(x1 > x1));
2087 assert(!(x1 == x1));
2089 assert(x1.get == T.min);
2091 assert(x1.get == T.min);
2093 assert(x1 == x1);
2094 assert(x1 <= x1);
2095 assert(x1 >= x1);
2096 static assert(x1.min == T.min + 1);
2106 assert(x1 != x1);
2108 assert(x1 < 1u);
2154 assert(x == short.max);
2156 assert(x == short.min);
2184 static assert(x == "-" || x == "++" || x == "--");
2205 static assert(false);
2210 assert(checked!Saturate(int.max) + 1 == int.max);
2211 assert(checked!Saturate(100) ^^ 10 == int.max);
2212 assert(checked!Saturate(-100) ^^ 10 == int.max);
2213 assert(checked!Saturate(100) / 0 == int.max);
2214 assert(checked!Saturate(100) << -1 == 0);
2215 assert(checked!Saturate(100) << 33 == int.max);
2216 assert(checked!Saturate(100) >> -1 == int.max);
2217 assert(checked!Saturate(100) >> 33 == 0);
2226 assert(x == int.max);
2228 assert(x == int.max - 1);
2230 assert(-x == int.max);
2232 assert(x == int.min);
2233 assert(x * -2 == int.max);
2295 static assert(isUnsigned!C);
2296 static assert(isUnsigned!L != isUnsigned!R);
2319 static assert(isUnsigned!C);
2320 static assert(isUnsigned!L != isUnsigned!R);
2394 else static assert(0, x);
2398 static assert(isUnsigned!Result);
2399 static assert(isUnsigned!L != isUnsigned!R);
2451 else static assert(0, x);
2453 debug assert(false);
2463 assert(opChecked!"+"(const short(1), short(1), overflow) == 2 && !overflow);
2464 assert(opChecked!"+"(1, 1, overflow) == 2 && !overflow);
2465 assert(opChecked!"+"(1, 1u, overflow) == 2 && !overflow);
2466 assert(opChecked!"+"(-1, 1u, overflow) == 0 && !overflow);
2467 assert(opChecked!"+"(1u, -1, overflow) == 0 && !overflow);
2474 assert(opChecked!"-"(1, 1, overflow) == 0 && !overflow);
2475 assert(opChecked!"-"(1, 1u, overflow) == 0 && !overflow);
2476 assert(opChecked!"-"(1u, -1, overflow) == 2 && !overflow);
2477 assert(opChecked!"-"(-1, 1u, overflow) == 0 && overflow);
2483 assert(opChecked!"*"(2, 3, overflow) == 6 && !overflow);
2484 assert(opChecked!"*"(2, 3u, overflow) == 6 && !overflow);
2485 assert(opChecked!"*"(1u, -1, overflow) == 0 && overflow);
2492 assert(opChecked!"/"(6, 3, overflow) == 2 && !overflow);
2493 assert(opChecked!"/"(6, 3, overflow) == 2 && !overflow);
2494 assert(opChecked!"/"(6u, 3, overflow) == 2 && !overflow);
2495 assert(opChecked!"/"(6, 3u, overflow) == 2 && !overflow);
2496 assert(opChecked!"/"(11, 0, overflow) == 0 && overflow);
2498 assert(opChecked!"/"(6u, 0, overflow) == 0 && overflow);
2500 assert(opChecked!"/"(-6, 2u, overflow) == 0 && overflow);
2502 assert(opChecked!"/"(-6, 0u, overflow) == 0 && overflow);
2504 assert(opChecked!"cmp"(0u, -6, overflow) == 1 && overflow);
2506 assert(opChecked!"|"(1, 2, overflow) == 3 && !overflow);
2557 assert((b > 1 || b < -1) && rhs > 1);
2566 assert(e > 1);
2592 assert(opChecked!"^^"(T(0), 0, overflow) == 1);
2593 assert(opChecked!"^^"(-2, T(0), overflow) == 1);
2594 assert(opChecked!"^^"(-2, T(1), overflow) == -2);
2595 assert(opChecked!"^^"(-1, -1, overflow) == -1);
2596 assert(opChecked!"^^"(-2, 1, overflow) == -2);
2597 assert(opChecked!"^^"(-2, -1, overflow) == 0);
2598 assert(opChecked!"^^"(-2, 4u, overflow) == 16);
2599 assert(!overflow);
2600 assert(opChecked!"^^"(-2, 3u, overflow) == 0);
2601 assert(overflow);
2603 assert(opChecked!"^^"(3, 64u, overflow) == 0);
2604 assert(overflow);
2608 assert(opChecked!"^^"(x, i, overflow) == x ^^ i);
2609 assert(!overflow);
2611 assert(opChecked!"^^"(x, e, overflow) == x ^^ e);
2612 assert(overflow);
2660 assert(x + y == 184);
2661 assert(x + 100 == 142);
2662 assert(y - x == 100);
2663 assert(200 - x == 158);
2664 assert(y * x == 142 * 42);
2665 assert(x / 1 == 42);
2666 assert(x % 20 == 2);
2669 assert(x1 + 0 == 42);
2670 assert(x1 + false == 42);
2671 assert(is(typeof(x1 + 0.5) == double));
2672 assert(x1 + 0.5 == 42.5);
2673 assert(x1.hook.calls == 0);
2674 assert(x1 + int.max == int.max + 42);
2675 assert(x1.hook.calls == 1);
2676 assert(x1 * 2 == 84);
2677 assert(x1.hook.calls == 1);
2678 assert(x1 / 2 == 21);
2679 assert(x1.hook.calls == 1);
2680 assert(x1 % 20 == 2);
2681 assert(x1.hook.calls == 1);
2682 assert(x1 << 2 == 42 << 2);
2683 assert(x1.hook.calls == 1);
2684 assert(x1 << 42 == x1.get << x1.get);
2685 assert(x1.hook.calls == 2);
2687 assert(x1 - 1 == int.max);
2688 assert(x1.hook.calls == 3);
2691 assert(x2 + 1 == 43);
2692 assert(x2.hook.calls == 1);
2695 assert(x3 + 1 == 43);
2696 assert(x3.hook.calls == 0);
2697 assert(x3 - 1 == 41);
2698 assert(x3.hook.calls == 0);
2699 assert(x3 + (-42) == 0);
2700 assert(x3.hook.calls == 0);
2701 assert(x3 - (-42) == 84);
2702 assert(x3.hook.calls == 0);
2703 assert(x3 * 2 == 84);
2704 assert(x3.hook.calls == 0);
2705 assert(x3 * -2 == -84);
2706 assert(x3.hook.calls == 1);
2707 assert(x3 / 2 == 21);
2708 assert(x3.hook.calls == 1);
2709 assert(x3 / -2 == 0);
2710 assert(x3.hook.calls == 2);
2711 assert(x3 ^^ 2 == 42 * 42);
2712 assert(x3.hook.calls == 2);
2715 assert(x4 + 1 == 43);
2716 assert(x4.hook.calls == 0);
2717 assert(x4 + 1u == 43);
2718 assert(x4.hook.calls == 0);
2719 assert(x4 - 1 == 41);
2720 assert(x4.hook.calls == 0);
2721 assert(x4 * 2 == 84);
2722 assert(x4.hook.calls == 0);
2724 assert(x4 + 2u == 0);
2725 assert(x4.hook.calls == 0);
2726 assert(x4 * 2u == -4);
2727 assert(x4.hook.calls == 1);
2730 assert(x5 ^^ 0 == 1);
2731 assert(x5 ^^ 1 == 3);
2732 assert(x5 ^^ 2 == 9);
2733 assert(x5 ^^ 3 == 27);
2734 assert(x5 ^^ 4 == 81);
2735 assert(x5 ^^ 5 == 81 * 3);
2736 assert(x5 ^^ 6 == 81 * 9);
2743 assert(1 + x1 == 43);
2744 assert(true + x1 == 43);
2745 assert(0.5 + x1 == 42.5);
2747 assert(x1 + x2 == 84);
2748 assert(x2 + x1 == 84);
2755 assert((x1 += 2) == 5);
2757 assert(x1.hook.calls == 1);
2759 assert(x1.hook.calls == 2);
2762 assert((x2 += 2) == 5);
2763 assert(x2.hook.calls == 0);
2764 assert((x2 += ushort.max) == cast(ushort) (ushort(5) + ushort.max));
2765 assert(x2.hook.calls == 1);
2769 assert(x3.hook.calls == 1);
2777 assert(x.get == 42);
2779 assert(x.get == 42);
2781 assert(x.get == 43);
2783 assert(x.get == 44);
2788 static assert(!is(typeof(Checked!(short, void)(ushort(42)))));
2789 static assert(!is(typeof(Checked!(int, void)(long(42)))));
2790 static assert(!is(typeof(Checked!(int, void)(ulong(42)))));
2791 assert(Checked!(short, void)(short(42)).get == 42);
2792 assert(Checked!(int, void)(ushort(42)).get == 42);
2798 static assert(is(typeof(cast(float) Checked!(int, void)(42)) == float));
2799 assert(cast(float) Checked!(int, void)(42) == 42);
2801 assert(is(typeof(cast(long) Checked!(int, void)(42)) == long));
2802 assert(cast(long) Checked!(int, void)(42) == 42);
2803 static assert(is(typeof(cast(long) Checked!(uint, void)(42u)) == long));
2804 assert(cast(long) Checked!(uint, void)(42u) == 42);
2807 if (x) {} else assert(0);
2809 if (x) assert(0);
2821 assert(cast(int) y == 42);
2822 assert(cast(uint) y == 42);
2823 assert(y.hook.calls == 2);
2835 assert(cast(ushort) x1 == 100);
2836 assert(cast(short) x1 == 100);
2837 assert(cast(float) x1 == 100);
2838 assert(cast(double) x1 == 100);
2839 assert(cast(real) x1 == 100);
2840 assert(x1.hook.calls == 0);
2841 assert(cast(int) x1 == 100);
2842 assert(x1.hook.calls == 0);
2844 assert(cast(int) x1 == 42);
2845 assert(x1.hook.calls == 1);
2848 assert(cast(short) x2 == -100);
2849 assert(cast(ushort) x2 == 42);
2850 assert(cast(uint) x2 == 42);
2851 assert(cast(ulong) x2 == 42);
2852 assert(x2.hook.calls == 3);
2858 assert(Checked!(int, void)(42) == 42L);
2859 assert(42UL == Checked!(int, void)(42));
2871 assert(x1 != Checked!(long, Hook1)(100));
2872 assert(x1.hook.calls == 1);
2873 assert(x1 != 100u);
2874 assert(x1.hook.calls == 2);
2886 assert(x2 != x1);
2888 assert(Checked!(uint, void)(100u) != x2);
2890 assert(Checked!(uint, void)(100u) == Checked!(int, void*)(100));
2891 assert(x2.hook.calls == 0);
2892 assert(x2 != -100);
2893 assert(x2.hook.calls == 1);
2894 assert(x2 != cast(uint) -100);
2895 assert(x2.hook.calls == 2);
2897 assert(x2 != cast(uint) 100);
2898 assert(x2.hook.calls == 3);
2902 assert(x3 != 100);
2904 assert(x3 != -1);
2906 assert(x2 != x3);
2913 assert(x <= x);
2914 assert(x < 45);
2915 assert(x < 45u);
2916 assert(x > -45);
2917 assert(x < 44.2);
2918 assert(x > -44.2);
2919 assert(!(x < double.init));
2920 assert(!(x > double.init));
2921 assert(!(x <= double.init));
2922 assert(!(x >= double.init));
2934 assert(!(x1 < 43u));
2935 assert(!(43u < x1));
2936 assert(x1.hook.calls == 2);
2948 assert(x2 < 43u);
2949 assert(43u > x2);
2950 assert(x2.hook.calls == 2);
2952 assert(x2 > 41u);
2955 assert(x3 > 41);
2956 assert(x3 > -41);
2963 assert(x == +x);
2964 static assert(is(typeof(-x) == typeof(x)));
2965 assert(-x == Checked!(int, void)(-42));
2966 static assert(is(typeof(~x) == typeof(x)));
2967 assert(~x == Checked!(int, void)(~42));
2968 assert(++x == 43);
2969 assert(--x == 42);
2986 assert(is(typeof(-x1) == typeof(x1)));
2987 assert(-x1 == Checked!(int, Hook1)(42));
2988 assert(is(typeof(~x1) == typeof(x1)));
2989 assert(~x1 == Checked!(int, Hook1)(43));
2990 assert(x1.hook.calls == 2);
3007 assert(++x2 == 99);
3008 assert(x2 == 99);
3009 assert(--x2 == 100);
3010 assert(x2 == 100);
3013 assert(++x3 == int.max);
3014 assert(x3.hook.calls == 0);
3015 assert(++x3 == int.min);
3016 assert(x3.hook.calls == 1);
3017 assert(-x3 == int.min);
3018 assert(x3.hook.calls == 2);
3021 assert(--x3 == int.min);
3022 assert(x3.hook.calls == 2);
3023 assert(--x3 == int.max);
3024 assert(x3.hook.calls == 3);
3031 assert(x == x);
3032 assert(x == +x);
3033 assert(x == -x);
3035 assert(x == 1);
3037 assert(x == 2);
3040 assert(x == 42);
3043 assert(x == _short);
3046 assert(x == _ushort);
3047 assert(x == 44.0);
3048 assert(x != 44.1);
3049 assert(x < 45);
3050 assert(x < 44.2);
3051 assert(x > -45);
3052 assert(x > -44.2);
3054 assert(cast(long) x == 44);
3055 assert(cast(short) x == 44);
3058 assert(y <= y);
3059 assert(y == 0);
3060 assert(y < x);
3062 assert(x > y);