You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
745 B
Go
36 lines
745 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"runtime"
|
|
"testing"
|
|
)
|
|
|
|
//Namenskonvention: Test…
|
|
func TestMeineIrgendwieBenannteTestingFunction(t *testing.T) {
|
|
// Die Globals werden auch im Test benötigt!
|
|
maxThreads = int8(runtime.NumCPU())
|
|
maxRoutines = maxThreads * ThreadFaktor
|
|
runtime.GOMAXPROCS(int(maxThreads))
|
|
|
|
testpaar := [...][2]int{{8978793242417717171, 1}, {5769977777, 0}}
|
|
|
|
for i, v := range testpaar {
|
|
ergebnisSoll := func(a int) bool {
|
|
if a > 0 {
|
|
return true
|
|
} else {
|
|
return false
|
|
}
|
|
}(v[1])
|
|
|
|
ergebnisIst := is_prime(&v[0])
|
|
|
|
if ergebnisIst != ergebnisSoll {
|
|
t.Error("Erwartung:", ergebnisSoll, "Ergebnis:", ergebnisIst)
|
|
} else {
|
|
fmt.Printf("Test %v OK: (%v = %v)\n", i, ergebnisSoll, ergebnisIst)
|
|
}
|
|
}
|
|
}
|