Source file test/typeparam/factimp.dir/main.go

     1  // Copyright 2021 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import (
     8  	"./a"
     9  	"fmt"
    10  )
    11  
    12  func main() {
    13  	const want = 120
    14  
    15  	if got := a.Fact(5); got != want {
    16  		panic(fmt.Sprintf("got %d, want %d", got, want))
    17  	}
    18  
    19  	if got := a.Fact[int64](5); got != want {
    20  		panic(fmt.Sprintf("got %d, want %d", got, want))
    21  	}
    22  
    23  	if got := a.Fact(5.0); got != want {
    24  		panic(fmt.Sprintf("got %f, want %f", got, want))
    25  	}
    26  }
    27  

View as plain text