aboutsummaryrefslogtreecommitdiff
path: root/internal/test/helpers.go
blob: c466c69925992b2813f1622511d7b4e4dc8ec7e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*******************************************************************************
* Copyright 2025 Stefan Majewsky <majewsky@gmx.net>
* SPDX-License-Identifier: Apache-2.0
* Refer to the file "LICENSE" for details.
*******************************************************************************/

package test

import (
	"reflect"
	"testing"
)

func AssertEqual[V any](t *testing.T, actual, expected V) bool {
	if reflect.DeepEqual(actual, expected) {
		return true
	}
	t.Helper()
	t.Errorf("expected %#v, but got %#v", expected, actual)
	return false
}

func PointerTo[V any](value V) *V {
	return &value
}