[refac] extract local var
[test] add tests for constant_factor