예제 #1
0
 public void CanRotateSingleChunkAndIgnoreLeftOvers()
 {
     Revrot.RevRot("123455", 5).Should().Be("23451");
     Revrot.RevRot("1234556", 5).Should().Be("23451");
     Revrot.RevRot("12345564", 5).Should().Be("23451");
     Revrot.RevRot("123455643", 5).Should().Be("23451");
 }
예제 #2
0
 public void SampleTests()
 {
     Console.WriteLine("Testing RevRot");
     testing(Revrot.RevRot("1234", 0), "");
     testing(Revrot.RevRot("", 0), "");
     testing(Revrot.RevRot("1234", 5), "");
     testing(Revrot.RevRot("733049910872815764", 5), "330479108928157");
     testing(Revrot.RevRot("123456987654", 6), "234561876549");
     testing(Revrot.RevRot("123456987653", 6), "234561356789");
     testing(Revrot.RevRot("66443875", 4), "44668753");
     testing(Revrot.RevRot("66443875", 8), "64438756");
     testing(Revrot.RevRot("664438769", 8), "67834466");
     testing(Revrot.RevRot("123456779", 8), "23456771");
     testing(Revrot.RevRot("", 8), "");
     testing(Revrot.RevRot("123456779", 0), "");
     testing(Revrot.RevRot("563000655734469485", 4), "0365065073456944");
 }
예제 #3
0
 public void CanRotateSingleChunk()
 {
     (((1 * 1 * 1) + (2 * 2 * 2) + (3 * 3 * 3) + (4 * 4 * 4) + (5 * 5 * 5)) % 2).ShouldNotBe(0);
     Revrot.RevRot("12345", 5).Should().Be("23451");
 }
예제 #4
0
 public void SizeZeroOrNegativeShouldReturnEmptyString()
 {
     Revrot.RevRot("123", 0).Should().Be(string.Empty);
     Revrot.RevRot("123", -1).Should().Be(string.Empty);
 }
예제 #5
0
 public void NullShouldReturnEmptyString()
 {
     Revrot.RevRot(null, 3).Should().Be(string.Empty);
 }
예제 #6
0
 public void CanReverseTwoChunks()
 {
     (((2 * 2 * 2) + (3 * 3 * 3) + (3 * 3 * 3)) % 2).ShouldBe(0);
     (((8 * 8 * 8) + (5 * 5 * 5) + (9 * 9 * 9)) % 2).ShouldBe(0);
     Revrot.RevRot("233859", 3).Should().Be("332958");
 }
예제 #7
0
 public void CanReverseSingleChunk()
 {
     (((2 * 2 * 2) + (3 * 3 * 3) + (3 * 3 * 3)) % 2).ShouldBe(0);
     Revrot.RevRot("233", 3).Should().Be("332");
 }
예제 #8
0
 public void CanRotateTwoChunks()
 {
     (((1 * 1 * 1) + (2 * 2 * 2) + (3 * 3 * 3) + (4 * 4 * 4) + (5 * 5 * 5)) % 2).ShouldNotBe(0);
     (((9 * 9 * 9) + (8 * 8 * 8) + (7 * 7 * 7) + (6 * 6 * 6) + (5 * 5 * 5)) % 2).ShouldNotBe(0);
     Revrot.RevRot("1234598765", 5).Should().Be("2345187659");
 }