Beispiel #1
0
            public void test02HowSumTabulation()
            {
                var list = default(LinkedList <int>);

                list = HowSum.Tabulation(5, new[] { 2, 3, 10 });
                Assert.AreEqual(5, list.Sum());
                list = HowSum.Tabulation(10, new[] { 2, 3, 6 });
                Assert.AreEqual(10, list.Sum());
                list = HowSum.Tabulation(20, new[] { 2, 3, 4 });
                Assert.AreEqual(20, list.Sum());
                list = HowSum.Tabulation(300, new[] { 7, 14 });
                Assert.IsNull(list);
            }
Beispiel #2
0
            public void test01HowSumMemoize()
            {
                var list = default(LinkedList <int>);

                list = HowSum.Memoize(5, new[] { 2, 3, 10 });
                Assert.AreEqual(5, list.Sum());
                list = HowSum.Memoize(10, new[] { 2, 3, 6 });
                Assert.AreEqual(10, list.Sum());
                list = HowSum.Memoize(20, new[] { 2, 3, 4 });
                Assert.AreEqual(20, list.Sum());
                list = HowSum.Memoize(300, new[] { 7, 14 });
                Assert.IsNull(list);
            }