public void PreValueAfterResize2() { int SMART_ARRAY_SIZE = 10; SmartArrayClass testSmartArray = new SmartArrayClass(SMART_ARRAY_SIZE - 5); testSmartArray.SetAtIndex(0, 1); testSmartArray.SetAtIndex(1, 2); testSmartArray.SetAtIndex(2, 3); testSmartArray.SetAtIndex(3, 4); //testSmartArray.SetAtIndex(9, 0); //Will give an error, to making sure that the array size has decreased to 5. int actual = testSmartArray.GetAtIndex(0); int expected = 1; Assert.AreEqual(expected, actual, 0.000001, "loc 0 preserved number is 1."); }
public void AddValueInLoc() { SmartArrayClass testSmartArray = new SmartArrayClass(SMART_ARRAY_SIZE); testSmartArray.SetAtIndex(0, 1); testSmartArray.SetAtIndex(1, 2); testSmartArray.SetAtIndex(2, 3); testSmartArray.SetAtIndex(3, 4); testSmartArray.SetAtIndex(4, 11); // assert int actual = testSmartArray.GetAtIndex(4); int expected = 11; Assert.AreEqual(expected, actual, 0.000001, "Number added in loc 5 is 11."); }
public void SetLocationAtSizeOfArrayValue() { SmartArrayClass testSmartArray = new SmartArrayClass(SMART_ARRAY_SIZE); testSmartArray.SetAtIndex(SMART_ARRAY_SIZE, 15); // assert is handled by ExpectedException }
public void IncreaseArraySize() { SmartArrayClass testSmartArray = new SmartArrayClass(SMART_ARRAY_SIZE + 5); testSmartArray.SetAtIndex(9, 10); int actual = testSmartArray.GetAtIndex(9); int expected = 10; Assert.AreEqual(expected, actual, 0.000001, "The search is not Loc 10."); }
public void SetLocation_0() { SmartArrayClass testSmartArray = new SmartArrayClass(SMART_ARRAY_SIZE); testSmartArray.SetAtIndex(0, 5); // assert int actual = testSmartArray.GetAtIndex(0); int expected = 5; Assert.AreEqual(expected, actual, 0.000001, "Did not set SmartArray loc 0 correctly"); }
public void ReturnTrueTest() { //Assemble SmartArrayClass testSmartArray = new SmartArrayClass(SMART_ARRAY_SIZE); testSmartArray.SetAtIndex(4, 11); //Act bool resault = testSmartArray.Find(11); //Assert Assert.IsTrue(resault); }
public void DecreaseArraySize() { int SMART_ARRAY_SIZE = 10; SmartArrayClass testSmartArray = new SmartArrayClass(SMART_ARRAY_SIZE - 5); //testSmartArray.SetAtIndex(5, 10); //Error testing, to see if the array is decreased down to 5 //int actual = testSmartArray.GetAtIndex(5); testSmartArray.SetAtIndex(4, 10); int actual = testSmartArray.GetAtIndex(4); int expected = 10; Assert.AreEqual(expected, actual, 0.000001, "The arrary length is bigger than 5."); }
public void ReturnFalseTest() { //Assemble SmartArrayClass testSmartArray = new SmartArrayClass(SMART_ARRAY_SIZE); testSmartArray.SetAtIndex(4, 11); //Act bool resault = testSmartArray.Find(12); //bool resault = testSmartArray.Find(11); //To test return false will fail. //Assert Assert.IsFalse(resault); }
public void NegativeIndexExcep() { SmartArrayClass testSmartArray = new SmartArrayClass(SMART_ARRAY_SIZE); testSmartArray.SetAtIndex(SMART_ARRAY_SIZE, -1); }