From cb10768fa14c4b6ec19d050e13a0c3e00c152874 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 16 Dec 2020 18:06:36 -0500 Subject: move project to subdirectory and add unit testing day 13 is removed from the test so it doesn't take 4 years --- lib/Extensions.cs | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 lib/Extensions.cs (limited to 'lib/Extensions.cs') diff --git a/lib/Extensions.cs b/lib/Extensions.cs deleted file mode 100644 index eb8c3cb..0000000 --- a/lib/Extensions.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; - -namespace aoc2019.lib -{ - public static class Extensions - { - public static IEnumerable> Permute(this IEnumerable list) - { - if (list.Count() == 1) return new[] {list}; - return list.SelectMany(t => Permute(list.Where(x => !x.Equals(t))), (v, p) => p.Prepend(v)); - } - - public static IEnumerable Chunk(this string str, int chunkSize) - { - for (var i = 0; i < str.Length; i += chunkSize) - yield return str.Substring(i, chunkSize); - } - - public static string ToDelimitedString(this IEnumerable enumerable, string delimiter = "") - { - return string.Join(delimiter, enumerable); - } - - public static IEnumerable Repeat(this IEnumerable sequence, int? count = null) - { - while (count == null || count-- > 0) - foreach (var item in sequence) - yield return item; - } - - /// - /// increased accuracy for stopwatch based on frequency. - /// - /// blog - /// details here - /// - /// - /// - /// - public static double ScaleMilliseconds(this Stopwatch stopwatch) - { - return 1_000 * stopwatch.ElapsedTicks / (double) Stopwatch.Frequency; - } - } -} \ No newline at end of file -- cgit 1.4.1