added function unit tests