[gparted] Add test for bug #771670 in BlockSpecial::operator==() (#781978)



commit f4008092dd99969299bef05b975a00f654026c4c
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sun May 7 14:18:27 2017 +0100

    Add test for bug #771670 in BlockSpecial::operator==() (#781978)
    
    Add a specific test for the failure found in bug 771670 and fixed by
    commit:
        253c4d641687f21a4656af0926af18371d47d654
        Fix BlockSpecial comparison (#771670)
    
    Bug 781978 - Add Google Test C++ test framework

 tests/test_BlockSpecial.cc |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/tests/test_BlockSpecial.cc b/tests/test_BlockSpecial.cc
index 1f82367..d204573 100644
--- a/tests/test_BlockSpecial.cc
+++ b/tests/test_BlockSpecial.cc
@@ -342,6 +342,18 @@ TEST( BlockSpecialTest, OperatorEqualsTwoDifferentBlockDevices )
        EXPECT_FALSE( bs1 == bs2 );
 }
 
+TEST( BlockSpecialTest, OperatorEqualsSameBlockDevicesWithMinorZero )
+{
+       // Test for fix in bug #771670.  Ensure that block devices with minor number 0 are
+       // compared by major, minor pair rather than by name.
+       BlockSpecial::clear_cache();
+       BlockSpecial::register_block_special( "/dev/mapper/encrypted_swap", 254, 0 );
+       BlockSpecial::register_block_special( "/dev/dm-0", 254, 0 );
+       BlockSpecial bs1( "/dev/mapper/encrypted_swap" );
+       BlockSpecial bs2( "/dev/dm-0" );
+       EXPECT_TRUE( bs1 == bs2 );
+}
+
 // FIXME: Write tests to fully check operator<() is working as intended.
 
 }  // namespace GParted


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]