mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:42:57 +08:00
Add failing test cases
This commit is contained in:
parent
1d92800761
commit
71fa0da7f4
78
osu.Game.Tests/Audio/SampleInfoEqualityTest.cs
Normal file
78
osu.Game.Tests/Audio/SampleInfoEqualityTest.cs
Normal file
@ -0,0 +1,78 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Audio;
|
||||
|
||||
namespace osu.Game.Tests.Audio
|
||||
{
|
||||
[TestFixture]
|
||||
public class SampleInfoEqualityTest
|
||||
{
|
||||
[Test]
|
||||
public void TestSameSingleSamplesAreEqual()
|
||||
{
|
||||
var first = new SampleInfo("sample");
|
||||
var second = new SampleInfo("sample");
|
||||
|
||||
assertEquality(first, second);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDifferentSingleSamplesAreNotEqual()
|
||||
{
|
||||
var first = new SampleInfo("first");
|
||||
var second = new SampleInfo("second");
|
||||
|
||||
assertNonEquality(first, second);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDifferentCountSampleSetsAreNotEqual()
|
||||
{
|
||||
var first = new SampleInfo("sample", "extra");
|
||||
var second = new SampleInfo("sample");
|
||||
|
||||
assertNonEquality(first, second);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDifferentSampleSetsOfSameCountAreNotEqual()
|
||||
{
|
||||
var first = new SampleInfo("first", "common");
|
||||
var second = new SampleInfo("common", "second");
|
||||
|
||||
assertNonEquality(first, second);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSameOrderSameSampleSetsAreEqual()
|
||||
{
|
||||
var first = new SampleInfo("first", "second");
|
||||
var second = new SampleInfo("first", "second");
|
||||
|
||||
assertEquality(first, second);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDifferentOrderSameSampleSetsAreEqual()
|
||||
{
|
||||
var first = new SampleInfo("first", "second");
|
||||
var second = new SampleInfo("second", "first");
|
||||
|
||||
assertEquality(first, second);
|
||||
}
|
||||
|
||||
private void assertEquality(SampleInfo first, SampleInfo second)
|
||||
{
|
||||
Assert.That(first.Equals(second), Is.True);
|
||||
Assert.That(first.GetHashCode(), Is.EqualTo(second.GetHashCode()));
|
||||
}
|
||||
|
||||
private void assertNonEquality(SampleInfo first, SampleInfo second)
|
||||
{
|
||||
Assert.That(first.Equals(second), Is.False);
|
||||
Assert.That(first.GetHashCode(), Is.Not.EqualTo(second.GetHashCode()));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user