add root.equals and todo.equals

This commit is contained in:
Bel LaPointe
2022-01-09 10:17:44 -05:00
parent 33ca7c60e1
commit c2d1381607
3 changed files with 54 additions and 0 deletions

View File

@@ -6,6 +6,20 @@ type Root struct {
Done []Todo
}
func (root Root) Equals(other Root) bool {
for i, slice := range [][2][]Todo{
[2][]Todo{root.Todo, other.Todo},
[2][]Todo{root.Scheduled, other.Scheduled},
[2][]Todo{root.Done, other.Done},
} {
_ = i
if !equalTodoSlices(slice[0], slice[1]) {
return false
}
}
return true
}
func (root *Root) MoveScheduledToTodo() {
for i := len(root.Scheduled) - 1; i >= 0; i-- {
if root.Scheduled[i].Triggered() {