test score calculation algorithm