github.com/zmap/zcrypto@v0.0.0-20240512203510-0fef58d9a9db/verifier/walk_test.go (about) 1 /* 2 * ZCrypto Copyright 2017 Regents of the University of Michigan 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 * use this file except in compliance with the License. You may obtain a copy 6 * of the License at http://www.apache.org/licenses/LICENSE-2.0 7 * 8 * Unless required by applicable law or agreed to in writing, software 9 * distributed under the License is distributed on an "AS IS" BASIS, 10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 11 * implied. See the License for the specific language governing 12 * permissions and limitations under the License. 13 */ 14 15 package verifier 16 17 import "testing" 18 19 func TestWalk(t *testing.T) { 20 type empty struct{} 21 22 for _, test := range verifyTests { 23 g := NewGraph() 24 test.parseSelf() 25 26 // Add the presented chain 27 // TODO 28 29 for _, c := range test.parsedIntermediates() { 30 g.AddCert(c) 31 } 32 for _, c := range test.parsedRoots() { 33 g.AddRoot(c) 34 } 35 36 // See what chains we got 37 actualChains := g.WalkChains(test.parsedLeaf()) 38 if err := test.compareChains(test.unionAllExpected(), actualChains); err != nil { 39 t.Errorf("%s: %s", test.Name, err) 40 } 41 } 42 }