Files
mgmt/lang/interpret_test/TestAstFunc2/fortytwo/main.mcl
James Shubin b3d1ed9e65 lang: funcs: core: math: Add a fortytwo function
This is mainly meant as a useful test case, but might as well have it be
fun too. As an aside, it taught me a surprising result about the %v verb
in printf, and we'll have to decide if it's an issue we care about.

https://github.com/golang/go/issues/46118

The interesting thing about this method is that it uses the simplepoly
API but has no input args-- only the output types are different. If it
had identical types in the input args, that might also have been
interesting, but it's more rare to have none. Hopefully this exercises
our type unification logic.
2021-05-12 03:30:25 -04:00

7 lines
268 B
Plaintext

import "fmt"
import "math"
# FIXME: floats don't print nicely: https://github.com/golang/go/issues/46118
# FIXME: This means that we see "42" for both, instead of 42.0 ...
test fmt.printf("int: %d", math.fortytwo()) {}
test fmt.printf("float: %f", math.fortytwo()) {}