github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/pkg/subsystem/service_test.go (about)

     1  // Copyright 2023 syzkaller project authors. All rights reserved.
     2  // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  package subsystem
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/stretchr/testify/assert"
    10  )
    11  
    12  func TestServiceChildren(t *testing.T) {
    13  	unrelated := &Subsystem{Name: "unrelated"}
    14  	parent := &Subsystem{Name: "parent"}
    15  	childA := &Subsystem{Name: "childA", Parents: []*Subsystem{parent}}
    16  	childB := &Subsystem{Name: "childB", Parents: []*Subsystem{parent}}
    17  	service := MustMakeService([]*Subsystem{unrelated, parent, childA, childB})
    18  	assert.ElementsMatch(t, service.Children(parent), []*Subsystem{childA, childB})
    19  }