compute cost defined. test cost value verified