MCPcopy Create free account
hub / github.com/cel-expr/cel-go / TestAlgorithmConstants

Function TestAlgorithmConstants

ext/security/hmac/hmac_test.go:187–215  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

185}
186
187func TestAlgorithmConstants(t *testing.T) {
188 env, err := cel.NewEnv(
189 hmaclib.Library(),
190 )
191 if err != nil {
192 t.Fatalf("cel.NewEnv failed: %v", err)
193 }
194
195 tests := []struct {
196 expr string
197 want string
198 }{
199 {`hmac.SHA256`, "SHA256"},
200 {`hmac.SHA384`, "SHA384"},
201 {`hmac.SHA512`, "SHA512"},
202 {`hmac.SHA224`, "SHA224"},
203 {`hmac.SHA512_256`, "SHA512_256"},
204 {`hmac.SHA512_224`, "SHA512_224"},
205 }
206
207 for _, tc := range tests {
208 t.Run(tc.expr, func(t *testing.T) {
209 got := evalExpr(t, env, tc.expr, nil)
210 if got != tc.want {
211 t.Errorf("Eval(%q) = %v, want %v", tc.expr, got, tc.want)
212 }
213 })
214 }
215}
216
217func TestHMACCompositionWithEncodersAndStrings(t *testing.T) {
218 env, err := cel.NewEnv(

Callers

nothing calls this directly

Calls 2

NewEnvFunction · 0.92
evalExprFunction · 0.70

Tested by

no test coverage detected