// Test: does fq_mont_reduce return the right value when called as a function?
use crypto::fieldq

fn main() {
    // Direct call
    let r1 = fq_mont_reduce(56826)
    println("fq_mont_reduce(56826) = " + int_to_str(r1))

    // Then call on the result
    let r2 = fq_mont_reduce(r1)
    println("fq_mont_reduce(" + int_to_str(r1) + ") = " + int_to_str(r2))

    // Full round trip
    let mt = fq_to_mont(42)
    println("fq_to_mont(42) = " + int_to_str(mt))
    let back = fq_from_mont(mt)
    println("fq_from_mont(" + int_to_str(mt) + ") = " + int_to_str(back))

    // Is back == 42?
    if back == 42 {
        println("ROUND TRIP OK")
    } else {
        println("ROUND TRIP FAILED: got " + int_to_str(back) + " expected 42")
    }
}
