public void testStartIndexOne() { MapperForIntegerIdsAndGeneralStringIds idMapper = MapperForIntegerIdsAndGeneralStringIds.CreateIdMapper(1); AreEqual(1, idMapper.CreateOrRetrieveIntegerId("ABC")); AreEqual(2, idMapper.CreateOrRetrieveIntegerId("DEF")); AreEqual(3, idMapper.CreateOrRetrieveIntegerId("GHI")); AreEqual(2, idMapper.CreateOrRetrieveIntegerId("DEF")); AreEqual(3, idMapper.GetNumberOfVertices()); AreEqual("ABC", idMapper.GetBackThePreviouslyStoredGeneralStringIdForInteger(1)); AreEqual("DEF", idMapper.GetBackThePreviouslyStoredGeneralStringIdForInteger(2)); AreEqual("GHI", idMapper.GetBackThePreviouslyStoredGeneralStringIdForInteger(3)); }
public void testStartIndexZero() { MapperForIntegerIdsAndGeneralStringIds idMapper = MapperForIntegerIdsAndGeneralStringIds.CreateIdMapper(0); AreEqual(0, idMapper.CreateOrRetrieveIntegerId("A")); AreEqual(1, idMapper.CreateOrRetrieveIntegerId("B")); AreEqual(0, idMapper.CreateOrRetrieveIntegerId("A")); AreEqual(2, idMapper.CreateOrRetrieveIntegerId("C")); AreEqual(0, idMapper.CreateOrRetrieveIntegerId("A")); AreEqual(3, idMapper.CreateOrRetrieveIntegerId("D")); AreEqual(4, idMapper.GetNumberOfVertices()); AreEqual("A", idMapper.GetBackThePreviouslyStoredGeneralStringIdForInteger(0)); AreEqual("B", idMapper.GetBackThePreviouslyStoredGeneralStringIdForInteger(1)); AreEqual("C", idMapper.GetBackThePreviouslyStoredGeneralStringIdForInteger(2)); AreEqual("D", idMapper.GetBackThePreviouslyStoredGeneralStringIdForInteger(3)); }