Compare commits

..

No commits in common. "cd9406900a09ead87df1c606e8e4b94e9db127c8" and "d56a0235af590ce189927fe8ba1bd08bc9e4b23f" have entirely different histories.

2 changed files with 2 additions and 25 deletions

View File

@ -1,5 +1,5 @@
package goext
const GoextVersion = "0.0.266"
const GoextVersion = "0.0.265"
const GoextVersionTimestamp = "2023-09-21T13:08:13+0200"
const GoextVersionTimestamp = "2023-09-18T12:57:27+0200"

View File

@ -2,41 +2,23 @@ package tst
import (
"encoding/hex"
"reflect"
"runtime/debug"
"testing"
)
func AssertEqual[T comparable](t *testing.T, actual T, expected T) {
t.Helper()
if actual != expected {
t.Errorf("values differ: Actual: '%v', Expected: '%v'", actual, expected)
}
}
func AssertNotEqual[T comparable](t *testing.T, actual T, expected T) {
t.Helper()
if actual == expected {
t.Errorf("values do not differ: Actual: '%v', Expected: '%v'", actual, expected)
}
}
func AssertDeepEqual[T comparable](t *testing.T, actual T, expected T) {
t.Helper()
if reflect.DeepEqual(actual, expected) {
t.Errorf("values differ: Actual: '%v', Expected: '%v'", actual, expected)
}
}
func AssertNotDeepEqual[T comparable](t *testing.T, actual T, expected T) {
t.Helper()
if !reflect.DeepEqual(actual, expected) {
t.Errorf("values do not differ: Actual: '%v', Expected: '%v'", actual, expected)
}
}
func AssertDeRefEqual[T comparable](t *testing.T, actual *T, expected T) {
t.Helper()
if actual == nil {
t.Errorf("values differ: Actual: NIL, Expected: '%v'", expected)
}
@ -46,7 +28,6 @@ func AssertDeRefEqual[T comparable](t *testing.T, actual *T, expected T) {
}
func AssertPtrEqual[T comparable](t *testing.T, actual *T, expected *T) {
t.Helper()
if actual == nil && expected == nil {
return
}
@ -66,7 +47,6 @@ func AssertPtrEqual[T comparable](t *testing.T, actual *T, expected *T) {
}
func AssertHexEqual(t *testing.T, expected string, actual []byte) {
t.Helper()
actualStr := hex.EncodeToString(actual)
if actualStr != expected {
t.Errorf("values differ: Actual: '%v', Expected: '%v'", actualStr, expected)
@ -74,21 +54,18 @@ func AssertHexEqual(t *testing.T, expected string, actual []byte) {
}
func AssertTrue(t *testing.T, value bool) {
t.Helper()
if !value {
t.Error("value should be true\n" + string(debug.Stack()))
}
}
func AssertFalse(t *testing.T, value bool) {
t.Helper()
if value {
t.Error("value should be false\n" + string(debug.Stack()))
}
}
func AssertNoErr(t *testing.T, anerr error) {
t.Helper()
if anerr != nil {
t.Error("Function returned an error: " + anerr.Error() + "\n" + string(debug.Stack()))
}