about summary refs log tree commit diff
path: root/lib/Extensions.cs
diff options
context:
space:
mode:
authorBen Harris <ben@tilde.team>2020-12-16 18:06:36 -0500
committerBen Harris <ben@tilde.team>2020-12-16 18:06:36 -0500
commitcb10768fa14c4b6ec19d050e13a0c3e00c152874 (patch)
tree2da56b45700f5dd1bde994cbeae04f18424a17c3 /lib/Extensions.cs
parent837527d487c7e232b36dd87c95a15b7852f2e057 (diff)
move project to subdirectory and add unit testing
day 13 is removed from the test so it doesn't take 4 years
Diffstat (limited to 'lib/Extensions.cs')
-rw-r--r--lib/Extensions.cs48
1 files changed, 0 insertions, 48 deletions
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<IEnumerable<T>> Permute<T>(this IEnumerable<T> 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<string> 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<T>(this IEnumerable<T> enumerable, string delimiter = "")
-        {
-            return string.Join(delimiter, enumerable);
-        }
-
-        public static IEnumerable<T> Repeat<T>(this IEnumerable<T> sequence, int? count = null)
-        {
-            while (count == null || count-- > 0)
-                foreach (var item in sequence)
-                    yield return item;
-        }
-
-        /// <summary>
-        ///     increased accuracy for stopwatch based on frequency.
-        ///     <see
-        ///         href="http://geekswithblogs.net/BlackRabbitCoder/archive/2012/01/12/c.net-little-pitfalls-stopwatch-ticks-are-not-timespan-ticks.aspx">
-        ///         blog
-        ///         details here
-        ///     </see>
-        /// </summary>
-        /// <param name="stopwatch"></param>
-        /// <returns></returns>
-        public static double ScaleMilliseconds(this Stopwatch stopwatch)
-        {
-            return 1_000 * stopwatch.ElapsedTicks / (double) Stopwatch.Frequency;
-        }
-    }
-}
\ No newline at end of file