// Package route // @Author: Wang Feng // @Description: // @Version: 0.1.0 // @Date: 2022/6/24 21:44 // @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室 // package route import ( "fmt" "minlib/component" "testing" ) // // TestRoutingTablePoolEntry_Init // @Description: 测试初始化 // @param t // func TestRoutingTablePoolEntry_Init(t *testing.T) { iden, _ := component.CreateIdentifierByString("/ifIhaveAnotherChance") rtpe := new(RoutingTablePoolEntry) rtpe.Init(iden) // 打印 fmt.Println(rtpe.m_useCount) fmt.Println(rtpe.m_destination.ToUri()) } // // TestRoutingTablePoolEntry_InitDest // @Description: 测试初始化 // @param t // func TestRoutingTablePoolEntry_InitDest(t *testing.T) { iden, _ := component.CreateIdentifierByString("/ifIhaveAnotherChance") rtpe := new(RoutingTablePoolEntry) rtpe.InitDest(iden, 123) // 打印 fmt.Println(rtpe.m_useCount) fmt.Println(rtpe.m_destination.ToUri()) } // // TestRoutingTablePoolEntry_IsEqual // @Description: 测试两个rtpe是否相等 // @param t // func TestRoutingTablePoolEntry_IsEqual(t *testing.T) { // 第一个 iden, _ := component.CreateIdentifierByString("/ifIhaveAnotherChance") rtpe := new(RoutingTablePoolEntry) rtpe.InitDest(iden, 123) hop := new(NextHop) hop.Init("/f", 1) rtpe.AddNextHop(hop) iden2, _ := component.CreateIdentifierByString("/ifIhaveAnotherChance") rtpe2 := new(RoutingTablePoolEntry) rtpe2.InitDest(iden2, 123) hop2 := new(NextHop) hop2.Init("/f", 2) rtpe2.AddNextHop(hop2) fmt.Println("是否相等: ", rtpe.IsEqual(rtpe2)) }