package utils

import (
	"fmt"
	"testing"
)

type TestStruct struct {
	Name string
	Age  int
}

var ts TestStruct = TestStruct{Name: "nihao", Age: 12}

func TestToString(t *testing.T) {
	var num int8 = 12

	fmt.Println("Should 12", ToString(num))
	if ToString(num) != "12" {
		t.Error("should 12")
	}

	fmt.Println("struct test", ToString(ts))
}

func TestStringStore(t *testing.T) {
	var testnum string = "64"
	var testint_bk int
	var ts_bk TestStruct
	var testfloat32 float32

	StringStore(testnum, &testint_bk)
	fmt.Println(testnum, testint_bk)
	StringStore(ToString(ts), &ts_bk)
	fmt.Println(ToString(ts), ts_bk)

	StringStore("3.14159265", &testfloat32)
	fmt.Println(testfloat32)
}

func TestAngle2LedNo(t *testing.T) {
	for i := 0; i <= 360; i++ {
		fmt.Println("ang: ", i, " led: ", Angle2LedNo2(i, 12, 4, false))
	}
}
