added tests for toDigit and fromDigit