Fix handling of test_value when the size is 0 in an optimization.