Source file test/typeparam/absdiffimp2.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  	if got, want := a.OrderedAbsDifference(1.0, -2.0), 3.0; got != want {
    14  		panic(fmt.Sprintf("got = %v, want = %v", got, want))
    15  	}
    16  	if got, want := a.OrderedAbsDifference(-1.0, 2.0), 3.0; got != want {
    17  		panic(fmt.Sprintf("got = %v, want = %v", got, want))
    18  	}
    19  	if got, want := a.OrderedAbsDifference(-20, 15), 35; got != want {
    20  		panic(fmt.Sprintf("got = %v, want = %v", got, want))
    21  	}
    22  
    23  	if got, want := a.ComplexAbsDifference(5.0+2.0i, 2.0-2.0i), 5+0i; got != want {
    24  		panic(fmt.Sprintf("got = %v, want = %v", got, want))
    25  	}
    26  	if got, want := a.ComplexAbsDifference(2.0-2.0i, 5.0+2.0i), 5+0i; got != want {
    27  		panic(fmt.Sprintf("got = %v, want = %v", got, want))
    28  	}
    29  }
    30  

View as plain text