Added test and implementation for the cosine similarity formula