From 6efada43e73c40e0c76c441f84cf02cc00d3eb1b Mon Sep 17 00:00:00 2001 From: vince Date: Sun, 26 Jul 2020 15:52:29 +0800 Subject: Implement the LRU Cache --- bug/bug.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'bug') diff --git a/bug/bug.go b/bug/bug.go index 2ee89031..3a770881 100644 --- a/bug/bug.go +++ b/bug/bug.go @@ -749,3 +749,22 @@ func (bug *Bug) Compile() Snapshot { return snap } + +// EquivalentBug returns true if two bugs are equal +func EquivalentBug(expected, actual *Bug) bool { + if len(expected.packs) != len(actual.packs) { + return false + } + + for i := range expected.packs { + for j := range expected.packs[i].Operations { + actual.packs[i].Operations[j].base().id = expected.packs[i].Operations[j].base().id + } + } + + if expected != actual { + return false + } + + return true +} -- cgit