I'm using google test to write some unit tests for a container class with iterators. I'd like to create a test that makes sure my const_iterator is properly const: namely, that I can't assign to it
MyContainer<MyType>::const_iterator cItr = MyContainerInstance.cbegin();
*cItr = MyType(); // this should fail.
Obviously this will fail to compile (IFF it's coded properly), but is there some way to use google test to leave some kind of check like this in the unit test? Or some way without google test that doesn't require integrating yet another library?
Aucun commentaire:
Enregistrer un commentaire