From c268be460f349d22b43930f219d2801cd4a17620 Mon Sep 17 00:00:00 2001 From: Bernhard Seckinger Date: Tue, 8 Oct 2019 17:38:21 +0200 Subject: [PATCH] Remove two duplicate unittests from std.bitmanip; --- std/bitmanip.d | 52 +++++++------------------------------------------- 1 file changed, 7 insertions(+), 45 deletions(-) diff --git a/std/bitmanip.d b/std/bitmanip.d index 7f9aeaa11..f6653ac81 100644 --- a/std/bitmanip.d +++ b/std/bitmanip.d @@ -277,6 +277,7 @@ of the bitfields storage. assert(obj.x == 2); assert(obj.y == 0); assert(obj.z == 2); + assert(obj.flag == false); } /** @@ -294,6 +295,12 @@ one bitfield with an empty name. uint, "", 6)); } + A a; + assert(a.flag1 == 0); + a.flag1 = 1; + assert(a.flag1 == 1); + a.flag1 = 0; + assert(a.flag1 == 0); } /// enums can be used too @@ -309,51 +316,6 @@ one bitfield with an empty name. } } -/** -Creates a bitfield pack of eight bits, which fit in -one `ubyte`. The bitfields are allocated starting from the -least significant bit, i.e. x occupies the two least significant bits -of the bitfields storage. -*/ -@safe unittest -{ - struct A - { - int a; - mixin(bitfields!( - uint, "x", 2, - int, "y", 3, - uint, "z", 2, - bool, "flag", 1)); - } - A obj; - obj.x = 2; - obj.z = obj.x; - - assert(obj.x == 2); - assert(obj.y == 0); - assert(obj.z == 2); - assert(obj.flag == false); -} - -/// Add empty fields for padding to have a total bit length of 8, 16, 32, or 64 -@safe unittest -{ - struct A - { - mixin(bitfields!( - bool, "flag1", 1, - bool, "flag2", 1, - uint, "", 6)); - } - A a; - assert(a.flag1 == 0); - a.flag1 = 1; - assert(a.flag1 == 1); - a.flag1 = 0; - assert(a.flag1 == 0); -} - /** This string mixin generator allows one to create tagged pointers inside $(D_PARAM struct)s and $(D_PARAM class)es.