[PLAT-6736] Refactor BasisFunctionGenerator and add tests