Beispiel #1
0
        public void should_return_minus_one_if_value_out_of_collection_on_index_searching()
        {
            double[] collection = new double[] { 1, 3, 4, 9, 10, 16, 18, 21, 27, 34 };

            double val1 = 40;
            double val2 = -10;

            int index1 = Tools.FindIndex(collection, val1);
            int index2 = Tools.FindIndex(collection, val2);

            Assert.IsTrue(index1 == -1 && index2 == -1);
        }
Beispiel #2
0
        public void should_return_first_last_and_middle_index_of_collection()
        {
            double[] collection = new double[] { 1, 3, 4, 9, 10, 16, 18, 21, 27, 34 };

            double val1 = 1;
            double val2 = 34;
            double val3 = 16;

            int index1 = Tools.FindIndex(collection, val1);
            int index2 = Tools.FindIndex(collection, val2);
            int index3 = Tools.FindIndex(collection, val3);

            Assert.IsTrue(index1 == 0 && index2 == 9 && index3 == 5);
        }