Skip to content

Add isogram exercise generator #258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions exercises/isogram/Example.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;

public class Isogram
public static class Isogram
{
public static bool IsIsogram(string word)
{
Expand All @@ -17,4 +17,4 @@ public static bool IsIsogram(string word)

return true;
}
}
}
62 changes: 47 additions & 15 deletions exercises/isogram/IsogramTest.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,52 @@
using Xunit;
using Xunit;

public class IsogramTest
{
[Theory]
[InlineData("duplicates", true)]
[InlineData("eleven", false)]
[InlineData("subdermatoglyphic", true)]
[InlineData("Alphabet", false)]
[InlineData("thumbscrew-japingly", true)]
[InlineData("Hjelmqvist-Gryb-Zock-Pfund-Wax", true)]
[InlineData("Heizölrückstoßabdämpfung", true)]
[InlineData("the quick brown fox", false)]
[InlineData("Emily Jung Schwartzkopf", true)]
[InlineData("éléphant", false)]
public void Isogram_correctly_detects_isograms(string input, bool expected)
{
Assert.Equal(expected, Isogram.IsIsogram(input));
[Fact]
public void Empty_string()
{
Assert.True(Isogram.IsIsogram(""));
}

[Fact(Skip = "Remove to run test")]
public void Isogram_with_only_lower_case_characters()
{
Assert.True(Isogram.IsIsogram("isogram"));
}

[Fact(Skip = "Remove to run test")]
public void Word_with_one_duplicated_character()
{
Assert.False(Isogram.IsIsogram("eleven"));
}

[Fact(Skip = "Remove to run test")]
public void Longest_reported_english_isogram()
{
Assert.True(Isogram.IsIsogram("subdermatoglyphic"));
}

[Fact(Skip = "Remove to run test")]
public void Word_with_duplicated_character_in_mixed_case()
{
Assert.False(Isogram.IsIsogram("Alphabet"));
}

[Fact(Skip = "Remove to run test")]
public void Hypothetical_isogrammic_word_with_hyphen()
{
Assert.True(Isogram.IsIsogram("thumbscrew-japingly"));
}

[Fact(Skip = "Remove to run test")]
public void Isogram_with_duplicated_non_letter_character()
{
Assert.True(Isogram.IsIsogram("Hjelmqvist-Gryb-Zock-Pfund-Wax"));
}

[Fact(Skip = "Remove to run test")]
public void Made_up_name_that_is_an_isogram()
{
Assert.True(Isogram.IsIsogram("Emily Jung Schwartzkopf"));
}
}
9 changes: 9 additions & 0 deletions generators/Exercises/IsogramExercise.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Generators.Exercises
{
public class IsogramExercise : BooleanExercise
{
public IsogramExercise() : base("isogram")
{
}
}
}