Wrote some tests to check that the caching process does not lead to aberrant values. Change-Id: I28137e66f430dbcf4417733d1274319dbadfc9af