Add test for optimizations