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

Add a specific test for the failure found in bug 771670 and fixed by
commit:
    253c4d6416
    Fix BlockSpecial comparison (#771670)

Bug 781978 - Add Google Test C++ test framework
This commit is contained in:
Mike Fleetwood 2017-05-07 14:18:27 +01:00 committed by Curtis Gedak
parent debbd811b8
commit f4008092dd
1 changed files with 12 additions and 0 deletions

View File

@ -342,6 +342,18 @@ TEST( BlockSpecialTest, OperatorEqualsTwoDifferentBlockDevices )
EXPECT_FALSE( bs1 == bs2 ); 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. // FIXME: Write tests to fully check operator<() is working as intended.
} // namespace GParted } // namespace GParted