You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: dependency_graph_test.go
    path of file: ./repos/gapid/gapis/resolve/dependencygraph2
    
    the code of the file until where you have to start completion: // Copyright (C) 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except
    
func TestBuilder(t *testing.T) {
	ctx := log.Testing(t)
	// cmds := make([]api.Cmd, 6)
	header := &capture.Header{ABI: device.LinuxX86_64}
	cmds := []api.Cmd{TestCmd{}, TestCmd{}, TestCmd{}, TestCmd{}, TestCmd{}, TestCmd{}}
	c, err := capture.NewGraphicsCapture(ctx, arena.New(), "test", header, &capture.InitialState{}, cmds)
	if !assert.For(ctx, "capture.NewGraphicsCapture").ThatError(err).Succeeded() {
		return
	}
	b := newDependencyGraphBuilder(ctx, DependencyGraphConfig{}, c, []api.Cmd{}, c.NewState(ctx))
	eg := newDependencyGraph(ctx, DependencyGraphConfig{}, c, []api.Cmd{}, []Node{})
	getNodeID := func(cmdID uint64) NodeID {
		return b.graphBuilder.GetCmdNodeID(api.CmdID(cmdID), api.SubCmdIdx{})
	}
	addNode := func(cmdID uint64) NodeID {
		return eg.addNode(CmdNode{api.SubCmdIdx{uint64(cmdID)}, 0})
	}
	refA, refB, refC := newTestRef(), newTestRef(), newTestRef()
	b.OnBeginCmd(ctx, 0, TestCmd{})
	b.OnWriteFrag(ctx, refA, api.FieldFragment{FIELD_A_B{}}, api.NilReference{}, refB, true)
	b.OnEndCmd(ctx, 0, TestCmd{})
	addNode(0)

	b.OnBeginCmd(ctx, 1, TestCmd{})
	b.OnWriteFrag(ctx, refB, api.FieldFragment{FIELD_B_C{}}, api.NilReference{}, refC, true)
	b.OnEndCmd(ctx, 1, TestCmd{})
	addNode(1)

	b.OnBeginCmd(ctx, 2, TestCmd{})
	b.OnReadFrag(ctx, refA, api.FieldFragment{FIELD_A_B{}}, refB, true)
	b.OnReadFrag(ctx, refB, api.FieldFragment{FIELD_B_C{}}, refC, true)
	b.OnEndCmd(ctx, 2, TestCmd{})
	addNode(2)
	eg.setDependencies(getNodeID(2), []NodeID{getNodeID(0), getNodeID(1)})

	// Sort the dependencies here. They are returned by iterating over
	// a map. Their order has no functional effect, just makes the
	// test deterministic.
	for i := range b.graphBuilder.GetGraph().dependenciesFrom {
		sort.Sort(&NodeIDSorter{b.graphBuilder.GetGraph().dependenciesFrom[i]})
	}

	// eg.Paths = b.graph.Paths
	assert.To(t).For("Reading struct should depend on writes to fields after last write to struct (0)").That(
		b.graphBuilder.GetGraph().dependenciesFrom).DeepEquals(eg.dependenciesFrom)

	b.OnBeginCmd(ctx, 3, TestCmd{})
	b.OnReadFrag(ctx, refB, api.FieldFragment{FIELD_B_C{}}, refC, true)
	b.OnEndCmd(ctx, 3, TestCmd{})
	addNode(3)
	eg.setDependencies(getNodeID(3), []NodeID{getNodeID(1)})

	// eg.Paths = b.graph.Paths
	assert.To(t).For("Reading field should not depend on write to struct before last write to field").That(
		b.graphBuilder.GetGraph()).DeepEquals(eg)

	b.OnBeginCmd(ctx, 4, TestCmd{})
	b.OnWriteFrag(ctx, refA, api.FieldFragment{FIELD_A_B{}}, refB, refB, true)
	b.OnEndCmd(ctx, 4, TestCmd{})
	addNode(4)

	b.OnBeginCmd(ctx, 5, TestCmd{})
	b.OnReadFrag(ctx, refA, api.FieldFragment{FIELD_A_B{}}, refB, true)
	b.OnEndCmd(ctx, 5, TestCmd{})
	addNode(5)
	eg.setDependencies(getNodeID(5), []NodeID{getNodeID(4)})

	// eg.Paths = b.graph.Paths
	assert.To(t).For("Reading field should only depend on write to struct after list write to field").That(
		b.graphBuilder.GetGraph()).DeepEquals(eg)
}