public void FindRangesWithSameValuesTest() { WhatSort target = new WhatSort(); string[] name = { "one", "two", "two", "three", "four", "four", "four" }; List <KeyValuePair <int, int> > expected = new List <KeyValuePair <int, int> >() { new KeyValuePair <int, int>(1, 2), new KeyValuePair <int, int>(4, 6) }; string[] name2 = { "one", "two", "three", "four" }; List <KeyValuePair <int, int> > expected2 = new List <KeyValuePair <int, int> >(); string[] name3 = { "one", "one", "one", "one", "two", "two", "three", "four", "four", "four", "four" }; List <KeyValuePair <int, int> > expected3 = new List <KeyValuePair <int, int> >() { new KeyValuePair <int, int>(0, 3), new KeyValuePair <int, int>(4, 5), new KeyValuePair <int, int>(7, 10) }; string[] name4 = { "one", "one", "two", "two" }; List <KeyValuePair <int, int> > expected4 = new List <KeyValuePair <int, int> >() { new KeyValuePair <int, int>(0, 1), new KeyValuePair <int, int>(2, 3) }; List <SRM164Div2.WhatSort.IColumnElement> nameCE = new List <SRM164Div2.WhatSort.IColumnElement>(); List <SRM164Div2.WhatSort.IColumnElement> nameCE2 = new List <SRM164Div2.WhatSort.IColumnElement>(); List <SRM164Div2.WhatSort.IColumnElement> nameCE3 = new List <SRM164Div2.WhatSort.IColumnElement>(); List <SRM164Div2.WhatSort.IColumnElement> nameCE4 = new List <SRM164Div2.WhatSort.IColumnElement>(); target.TransformInput(name, new int[0], new int[0], nameCE, null, null); target.TransformInput(name2, new int[0], new int[0], nameCE2, null, null); target.TransformInput(name3, new int[0], new int[0], nameCE3, null, null); target.TransformInput(name4, new int[0], new int[0], nameCE4, null, null); List <KeyValuePair <int, int> > actual; actual = target.FindRangesWithSameValues(nameCE); Assert.IsTrue(AreSameRanges(expected, actual)); actual = target.FindRangesWithSameValues(nameCE2); Assert.IsTrue(AreSameRanges(expected2, actual)); actual = target.FindRangesWithSameValues(nameCE3); Assert.IsTrue(AreSameRanges(expected3, actual)); actual = target.FindRangesWithSameValues(nameCE4); Assert.IsTrue(AreSameRanges(expected4, actual)); }
public void sortTypeTest2() { WhatSort target = new WhatSort(); string[] name = { "BOB", "BOB", "DAVE", "DAVE" }; int[] age = { 22, 35, 35, 30 }; int[] wt = { 122, 122, 195, 200 }; string expected = "NOT"; string actual; actual = target.sortType(name, age, wt); Assert.IsTrue(expected.CompareTo(actual) == 0); }
public void sortTypeTest6() { WhatSort target = new WhatSort(); string[] name = { "A", "A", "A", "A" }; int[] age = { 1, 2, 3, 4 }; int[] wt = { 6, 5, 4, 3 }; string expected = "IND"; // NAW, NWA, and more string actual; actual = target.sortType(name, age, wt); Assert.IsTrue(expected.CompareTo(actual) == 0); }