Files
swift-mirror/test/Backtracing/Inputs/Inlining.swift
Alastair Houghton ee5596428f [Backtracing][Linux] Enable Linux backtracing, add tests.
Turn on the Linux backtracing implementation and update the tests.

rdar://101623265
2023-06-07 09:08:18 +01:00

30 lines
592 B
Swift

func square(_ x: Int) -> Int {
return x * x
}
func euclid2(_ a: Int, _ b: Int) -> Int {
return square(a) + square(b)
}
@main
struct Inlining {
static func main() {
if CommandLine.argc != 3 {
print("usage: Inlining <a> <b>")
exit(1)
}
guard let a = Int(CommandLine.arguments[1]) else {
print("Argument <a> must be a number")
exit(1)
}
guard let b = Int(CommandLine.arguments[2]) else {
print("Argument <b> must be a number")
exit(1)
}
let result = euclid2(a, b)
print("\(a) * \(a) + \(b) * \(b) = \(result)")
}
}