Skip to content

Instantly share code, notes, and snippets.

@juanplopes
Created January 16, 2011 15:30
Show Gist options
  • Save juanplopes/781883 to your computer and use it in GitHub Desktop.
Save juanplopes/781883 to your computer and use it in GitHub Desktop.
[Test]
public void GetMovesOneSquareForward_A2_ReturnsPromotions()
{
var bp = new BlackPawns(Bitboard.With.A2);
var m = bp.GetMovesOneSquareForward();
m.Should().Have.SameSequenceAs(
new Move("A2", "A1", MoveTypes.PawnToQueenPromotion),
new Move("A2", "A1", MoveTypes.PawnToRookPromotion),
new Move("A2", "A1", MoveTypes.PawnToBishopPromotion),
new Move("A2", "A1", MoveTypes.PawnToKnightPromotion));
}
[Test]
public void GetMovesOneSquareForward_A2_ReturnsPromotions()
{
var bp = new BlackPawns(new Bitboard().Set(new Square("A2")));
var m = bp.GetMovesOneSquareForward();
var moves = m.GetEnumerator();
moves.MoveNext();
var f1 = moves.Current;
f1.From.Should().Be(new Square("A2"));
f1.To.Should().Be(new Square("A1"));
f1.Type.Should().Be(MoveTypes.PawnToQueenPromotion);
moves.MoveNext();
var f2 = moves.Current;
f2.From.Should().Be(new Square("A2"));
f2.To.Should().Be(new Square("A1"));
f2.Type.Should().Be(MoveTypes.PawnToRookPromotion);
moves.MoveNext();
var f3 = moves.Current;
f3.From.Should().Be(new Square("A2"));
f3.To.Should().Be(new Square("A1"));
f3.Type.Should().Be(MoveTypes.PawnToBishopPromotion);
moves.MoveNext();
var f4 = moves.Current;
f4.From.Should().Be(new Square("A2"));
f4.To.Should().Be(new Square("A1"));
f4.Type.Should().Be(MoveTypes.PawnToKnightPromotion);
m.Count().Should().Be(4);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment