47 lines
775 B
Go
47 lines
775 B
Go
package lang
|
|
|
|
// Basic comparison utilities for parser tests
|
|
|
|
// Helper functions for creating pointers
|
|
func stringPtr(s string) *string {
|
|
return &s
|
|
}
|
|
|
|
func intPtr(i int) *int {
|
|
return &i
|
|
}
|
|
|
|
// Pointer comparison functions
|
|
func stringPtrEqual(got, want *string) bool {
|
|
if (got == nil) != (want == nil) {
|
|
return false
|
|
}
|
|
if got != nil && want != nil {
|
|
return *got == *want
|
|
}
|
|
return true
|
|
}
|
|
|
|
func intPtrEqual(got, want *int) bool {
|
|
if (got == nil) != (want == nil) {
|
|
return false
|
|
}
|
|
if got != nil && want != nil {
|
|
return *got == *want
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Slice comparison functions
|
|
func stringSliceEqual(got, want []string) bool {
|
|
if len(got) != len(want) {
|
|
return false
|
|
}
|
|
for i, s := range got {
|
|
if s != want[i] {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|