Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JustDravee/e5f6885e7b055914655eae3bd5d93920 to your computer and use it in GitHub Desktop.
Save JustDravee/e5f6885e7b055914655eae3bd5d93920 to your computer and use it in GitHub Desktop.
import 'package:interview_algorithms_dart/longest-substring-without-repeating-characters.dart';
import 'package:test/test.dart';
void main() {
test("Chaîne vide", () {
expect(longestSubstringWithoutRepeatingCharacters(""), "");
});
test("Chaîne entière", () {
expect(
longestSubstringWithoutRepeatingCharacters("ilovecats"), "ilovecats");
});
test("Caractère répété", () {
expect(longestSubstringWithoutRepeatingCharacters("aaaaaaaaaa"), "a");
});
test("Double caractère répété", () {
expect(longestSubstringWithoutRepeatingCharacters("aaaaabbbbbb"), "ab");
});
test("Double caractère répété puis mot", () {
expect(longestSubstringWithoutRepeatingCharacters("aaaaabbbbbbot"), "bot");
});
test("Mot répété", () {
expect(longestSubstringWithoutRepeatingCharacters("catcatcat"), "cat");
});
test("Début de chaîne", () {
expect(
longestSubstringWithoutRepeatingCharacters("lamernoire"), "lamernoi");
});
test("Milieu de chaîne", () {
expect(longestSubstringWithoutRepeatingCharacters("aaamazeeee"), "maze");
});
test("Fin de chaîne", () {
expect(longestSubstringWithoutRepeatingCharacters("amazing"), "mazing");
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment