feat(covenant): add GetHas alias mirrors

This commit is contained in:
Virgil 2026-04-04 06:13:47 +00:00
parent 85f053d971
commit ffcaa51187
4 changed files with 140 additions and 0 deletions

View file

@ -62,6 +62,13 @@ func HasLockedName(name string) bool {
return DefaultLockedCatalog().HasByName(name)
}
// GetHasLockedName is an alias for HasLockedName.
//
// ok := covenant.GetHasLockedName("example")
func GetHasLockedName(name string) bool {
return HasLockedName(name)
}
// HasLockedByName is an alias for HasLockedName.
//
// ok := covenant.HasLockedByName("example")
@ -69,6 +76,13 @@ func HasLockedByName(name string) bool {
return HasLockedName(name)
}
// GetHasLockedByName is an alias for HasLockedByName.
//
// ok := covenant.GetHasLockedByName("example")
func GetHasLockedByName(name string) bool {
return HasLockedByName(name)
}
// HasLockedString is an alias for HasLockedName.
//
// ok := covenant.HasLockedString("example")
@ -76,6 +90,13 @@ func HasLockedString(name string) bool {
return HasLockedName(name)
}
// GetHasLockedString is an alias for HasLockedString.
//
// ok := covenant.GetHasLockedString("example")
func GetHasLockedString(name string) bool {
return HasLockedString(name)
}
// HasLockedBinary is an alias for HasLockedName.
//
// ok := covenant.HasLockedBinary([]byte("example"))
@ -83,6 +104,13 @@ func HasLockedBinary(name []byte) bool {
return HasLockedName(string(name))
}
// GetHasLockedBinary is an alias for HasLockedBinary.
//
// ok := covenant.GetHasLockedBinary([]byte("example"))
func GetHasLockedBinary(name []byte) bool {
return HasLockedBinary(name)
}
// GetLockedName returns the locked-name entry for the provided label.
//
// The input is lower-cased before hashing, and canonical `.lthn` suffixes are
@ -121,6 +149,13 @@ func HasLockedByString(name string) bool {
return HasLockedString(name)
}
// GetHasLockedByString is an alias for HasLockedByString.
//
// ok := covenant.GetHasLockedByString("example")
func GetHasLockedByString(name string) bool {
return HasLockedByString(name)
}
// HasLockedByBinary is an alias for HasLockedBinary.
//
// ok := covenant.HasLockedByBinary([]byte("example"))
@ -128,6 +163,13 @@ func HasLockedByBinary(name []byte) bool {
return HasLockedBinary(name)
}
// GetHasLockedByBinary is an alias for HasLockedByBinary.
//
// ok := covenant.GetHasLockedByBinary([]byte("example"))
func GetHasLockedByBinary(name []byte) bool {
return HasLockedByBinary(name)
}
// GetLockedByString is an alias for GetLockedString.
//
// item, ok := covenant.GetLockedByString("example")

View file

@ -109,10 +109,26 @@ func TestLockedLookupStringAndBinaryAliases(t *testing.T) {
t.Fatal("HasLockedString should report locked catalog labels")
}
if !GetHasLockedName("nec.lthn") {
t.Fatal("GetHasLockedName should accept canonical .lthn names")
}
if !GetHasLockedByName("NEC") {
t.Fatal("GetHasLockedByName should report locked catalog labels")
}
if !GetHasLockedString("NEC") {
t.Fatal("GetHasLockedString should report locked catalog labels")
}
if !HasLockedBinary([]byte("NEC")) {
t.Fatal("HasLockedBinary should report locked catalog labels")
}
if !GetHasLockedBinary([]byte("NEC")) {
t.Fatal("GetHasLockedBinary should report locked catalog labels")
}
if _, ok := GetLockedByString("NEC"); !ok {
t.Fatal("GetLockedByString should find the locked reference entry")
}
@ -125,10 +141,18 @@ func TestLockedLookupStringAndBinaryAliases(t *testing.T) {
t.Fatal("HasLockedByString should report locked catalog labels")
}
if !GetHasLockedByString("NEC") {
t.Fatal("GetHasLockedByString should report locked catalog labels")
}
if !HasLockedByBinary([]byte("NEC")) {
t.Fatal("HasLockedByBinary should report locked catalog labels")
}
if !GetHasLockedByBinary([]byte("NEC")) {
t.Fatal("GetHasLockedByBinary should report locked catalog labels")
}
item, ok = GetLockedName("nec.lthn")
if !ok {
t.Fatal("GetLockedName should accept canonical .lthn names")
@ -157,6 +181,10 @@ func TestLockedLookupHasByHashAlias(t *testing.T) {
t.Fatal("GetHasLockedHash should alias HasLockedHash")
}
if !GetHasLockedByHash(hash) {
t.Fatal("GetHasLockedByHash should alias HasLockedByHash")
}
if !HasLockedByHash(hash) {
t.Fatal("HasLockedByHash should report the locked reference entry")
}

View file

@ -78,6 +78,13 @@ func HasReservedName(name string) bool {
return DefaultReservedCatalog().HasByName(name)
}
// GetHasReservedName is an alias for HasReservedName.
//
// ok := covenant.GetHasReservedName("example")
func GetHasReservedName(name string) bool {
return HasReservedName(name)
}
// HasReservedByName is an alias for HasReservedName.
//
// ok := covenant.HasReservedByName("example")
@ -92,6 +99,13 @@ func HasReservedString(name string) bool {
return HasReservedName(name)
}
// GetHasReservedString is an alias for HasReservedString.
//
// ok := covenant.GetHasReservedString("example")
func GetHasReservedString(name string) bool {
return HasReservedString(name)
}
// HasReservedBinary is an alias for HasReservedName.
//
// ok := covenant.HasReservedBinary([]byte("example"))
@ -99,6 +113,13 @@ func HasReservedBinary(name []byte) bool {
return HasReservedName(string(name))
}
// GetHasReservedBinary is an alias for HasReservedBinary.
//
// ok := covenant.GetHasReservedBinary([]byte("example"))
func GetHasReservedBinary(name []byte) bool {
return HasReservedBinary(name)
}
// GetReservedName returns the reserved-name entry for the provided label.
//
// The input is lower-cased before hashing, and canonical `.lthn` suffixes are
@ -137,6 +158,13 @@ func HasReservedByString(name string) bool {
return HasReservedString(name)
}
// GetHasReservedByString is an alias for HasReservedByString.
//
// ok := covenant.GetHasReservedByString("example")
func GetHasReservedByString(name string) bool {
return HasReservedByString(name)
}
// HasReservedByBinary is an alias for HasReservedBinary.
//
// ok := covenant.HasReservedByBinary([]byte("example"))
@ -144,6 +172,13 @@ func HasReservedByBinary(name []byte) bool {
return HasReservedBinary(name)
}
// GetHasReservedByBinary is an alias for HasReservedByBinary.
//
// ok := covenant.GetHasReservedByBinary([]byte("example"))
func GetHasReservedByBinary(name []byte) bool {
return HasReservedByBinary(name)
}
// GetReservedByString is an alias for GetReservedString.
//
// item, ok := covenant.GetReservedByString("example")
@ -200,6 +235,13 @@ func GetHasReservedByHash(hash primitives.Hash) bool {
return HasReservedByHash(hash)
}
// GetHasReservedByName is an alias for HasReservedByName.
//
// ok := covenant.GetHasReservedByName("example")
func GetHasReservedByName(name string) bool {
return HasReservedByName(name)
}
// DefaultReservedCatalog returns the lazily loaded reserved-name catalog.
//
// catalog := covenant.DefaultReservedCatalog()

View file

@ -113,6 +113,22 @@ func TestReservedLookupStringAndBinaryAliases(t *testing.T) {
t.Fatal("HasReservedString should report reserved catalog labels")
}
if !GetHasReservedName("reserved.lthn") {
t.Fatal("GetHasReservedName should accept canonical .lthn names")
}
if !GetHasReservedByName("RESERVED") {
t.Fatal("GetHasReservedByName should report reserved catalog labels")
}
if !GetHasReservedString("RESERVED") {
t.Fatal("GetHasReservedString should report reserved catalog labels")
}
if !GetHasReservedBinary([]byte("RESERVED")) {
t.Fatal("GetHasReservedBinary should report reserved catalog labels")
}
if !HasReservedBinary([]byte("RESERVED")) {
t.Fatal("HasReservedBinary should report reserved catalog labels")
}
@ -129,10 +145,18 @@ func TestReservedLookupStringAndBinaryAliases(t *testing.T) {
t.Fatal("HasReservedByString should report reserved catalog labels")
}
if !GetHasReservedByString("RESERVED") {
t.Fatal("GetHasReservedByString should report reserved catalog labels")
}
if !HasReservedByBinary([]byte("RESERVED")) {
t.Fatal("HasReservedByBinary should report reserved catalog labels")
}
if !GetHasReservedByBinary([]byte("RESERVED")) {
t.Fatal("GetHasReservedByBinary should report reserved catalog labels")
}
item, ok = GetReservedName("reserved.lthn")
if !ok {
t.Fatal("GetReservedName should accept canonical .lthn names")
@ -161,6 +185,10 @@ func TestReservedLookupHasByHashAlias(t *testing.T) {
t.Fatal("GetHasReservedHash should alias HasReservedHash")
}
if !GetHasReservedByHash(hash) {
t.Fatal("GetHasReservedByHash should alias HasReservedByHash")
}
if !HasReservedByHash(hash) {
t.Fatal("HasReservedByHash should report the reserved reference entry")
}