MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / TestExtended

Function TestExtended

math/gcd/extended_test.go:10–29  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8import "testing"
9
10func TestExtended(t *testing.T) {
11 var testCasesExtended = []struct {
12 name string
13 a int64
14 b int64
15 gcd int64
16 x int64
17 y int64
18 }{
19 {"gcd of 30 and 50", 30, 50, 10, 2, -1},
20 }
21 for _, tc := range testCasesExtended {
22 t.Run(tc.name, func(t *testing.T) {
23 gcd, x, y := Extended(tc.a, tc.b)
24 if gcd != tc.gcd && x != tc.x && y != tc.y {
25 t.Fatalf("Expected values:\n\tGCD: Expected %v Returned %v,\n\tx: Expected %v Returned %v\n\ty: Expected %v Returned %v", tc.gcd, gcd, tc.x, x, tc.y, y)
26 }
27 })
28 }
29}

Callers

nothing calls this directly

Calls 1

ExtendedFunction · 0.85

Tested by

no test coverage detected