mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-09 20:47:44 +00:00
Merge branch 'main' into ordered-libopenapi
This commit is contained in:
@@ -107,6 +107,38 @@ biscuit:
|
||||
assert.Equal(t, 1, extChanges.TotalBreakingChanges())
|
||||
}
|
||||
|
||||
// codecov seems to get upset with this not being covered.
|
||||
// so lets run the damn thing a few hundred thousand times.
|
||||
func BenchmarkCompareSecurityRequirement_Remove(b *testing.B) {
|
||||
|
||||
left := `auth:
|
||||
- pizza
|
||||
- pie`
|
||||
|
||||
right := `auth:
|
||||
- pie
|
||||
- pizza
|
||||
biscuit:
|
||||
- digestive`
|
||||
|
||||
var lNode, rNode yaml.Node
|
||||
_ = yaml.Unmarshal([]byte(left), &lNode)
|
||||
_ = yaml.Unmarshal([]byte(right), &rNode)
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
var lDoc base.SecurityRequirement
|
||||
var rDoc base.SecurityRequirement
|
||||
_ = low.BuildModel(lNode.Content[0], &lDoc)
|
||||
_ = low.BuildModel(rNode.Content[0], &rDoc)
|
||||
_ = lDoc.Build(context.Background(), nil, lNode.Content[0], nil)
|
||||
_ = rDoc.Build(context.Background(), nil, rNode.Content[0], nil)
|
||||
extChanges := CompareSecurityRequirement(&rDoc, &lDoc)
|
||||
assert.Equal(b, 1, extChanges.TotalChanges())
|
||||
assert.Len(b, extChanges.GetAllChanges(), 1)
|
||||
assert.Equal(b, 1, extChanges.TotalBreakingChanges())
|
||||
}
|
||||
}
|
||||
|
||||
func TestCompareSecurityRequirement_SwapOut_V2(t *testing.T) {
|
||||
|
||||
left := `cheese:
|
||||
|
||||
Reference in New Issue
Block a user