package tf

import (
	"fmt"
	"testing"

	"github.com/gogo/protobuf/proto"
)

func TestTFProto(t *testing.T) {
	request := PredictRequest{SignatureName: "predict"}
	x := ArrayProto{Dtype: ArrayDataType_DT_INT16, IntVal: []int32{5}, ArrayShape: &ArrayShape{Dim: []int64{0}}}
	request.Inputs = make(map[string]*ArrayProto)
	request.Inputs["x"] = &x

	data, err := proto.Marshal(&request)

	if err != nil {
		t.Error(err)
	}

	fmt.Println(data)
	newRequest := &PredictRequest{}
	err = proto.Unmarshal(data, newRequest)
	if err != nil {
		t.Error(err)
	}

	fmt.Println(newRequest.SignatureName, newRequest.Inputs)
}
