Laws are not software programs. Intent is a part of them, and it was clear the intent was for the testing to be representative of actual usage. It was not because the cars detected a test and changed behavior. That's a clear attempt to circumvent the regulation.
It's some time since I read the details but I remember that lots of people agreed it was not the actual usage, which btw made detecting it so easy. The acceleration was unrealistically long and slow, for example.