MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / valuesEqual

Function valuesEqual

tests/contract/contract_test.go:579–596  ·  view source on GitHub ↗

valuesEqual compares a JSON-decoded value with a YAML-decoded expected value, handling cross-type numeric comparison (JSON float64 vs YAML int).

(jsonVal, yamlVal interface{})

Source from the content-addressed store, hash-verified

577// valuesEqual compares a JSON-decoded value with a YAML-decoded expected value,
578// handling cross-type numeric comparison (JSON float64 vs YAML int).
579func valuesEqual(jsonVal, yamlVal interface{}) bool {
580 switch yv := yamlVal.(type) {
581 case int:
582 switch jv := jsonVal.(type) {
583 case float64:
584 return jv == float64(yv)
585 case int:
586 return jv == yv
587 }
588 case bool:
589 jv, ok := jsonVal.(bool)
590 return ok && jv == yv
591 case string:
592 jv, ok := jsonVal.(string)
593 return ok && jv == yv
594 }
595 return fmt.Sprintf("%v", jsonVal) == fmt.Sprintf("%v", yamlVal)
596}
597
598// extractEmailFromWSPath extracts the agent email from a WS path like
599// /v1/agents/bot@ws.test.dev/ws

Callers 2

execRequestMethod · 0.70
execWSReadMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected