26 lines
662 B
Go
26 lines
662 B
Go
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
package main
|
|
|
|
import "testing"
|
|
|
|
func TestDerivedFamily(t *testing.T) {
|
|
for _, n := range []string{"JEQ", "JLT", "JCC", "CMOVLGT", "SETNE", "SETA"} {
|
|
if !derivedFamily(n) {
|
|
t.Errorf("derivedFamily(%q) = false, want true", n)
|
|
}
|
|
}
|
|
for _, n := range []string{"JMP", "ADDQ", "VPGATHERDD", "MOVBE", "PSHUFB"} {
|
|
if derivedFamily(n) {
|
|
t.Errorf("derivedFamily(%q) = true, want false", n)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestSanitize(t *testing.T) {
|
|
if got := sanitize("VPCMP.UB"); got != "VPCMP_UB" {
|
|
t.Errorf("sanitize: got %q", got)
|
|
}
|
|
}
|