mirror of
				https://github.com/krahets/hello-algo.git
				synced 2025-11-04 14:18:20 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			22 lines
		
	
	
		
			319 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			319 B
		
	
	
	
		
			Go
		
	
	
	
	
	
// File: tree_node_test.go
 | 
						|
// Created Time: 2022-11-25
 | 
						|
// Author: Reanon (793584285@qq.com)
 | 
						|
 | 
						|
package pkg
 | 
						|
 | 
						|
import (
 | 
						|
	"fmt"
 | 
						|
	"testing"
 | 
						|
)
 | 
						|
 | 
						|
func TestTreeNode(t *testing.T) {
 | 
						|
	arr := []any{1, 2, 3, nil, 5, 6, nil}
 | 
						|
	node := SliceToTree(arr)
 | 
						|
 | 
						|
	// print tree
 | 
						|
	PrintTree(node)
 | 
						|
 | 
						|
	// tree to arr
 | 
						|
	fmt.Println(TreeToSlice(node))
 | 
						|
}
 |