Added tests cases to Document to verify the effectiveness of the
encoding of partial functions and lambdas.