Add test for soft constraint function