package model

import (
	"reflect"
	"testing"

	"app.yhyue.com/moapp/jybase/mongodb"
	"app.yhyue.com/moapp/jybase/mysql"
)

var (
	BaseMysql *mysql.Mysql
	MgoJy     mongodb.MongodbSim
)

func init() {
	BaseMysql = &mysql.Mysql{
		Address:      "192.168.3.217:4000",
		UserName:     "root",
		PassWord:     "=PDT49#80Z!RVv52_z",
		DBName:       "base_service",
		MaxOpenConns: 5,
		MaxIdleConns: 5,
	}

	//mongo初始化
	MgoJy = mongodb.MongodbSim{
		MongodbAddr: "192.168.3.206:27080",
		Size:        50,
		DbName:      "qfw",
	}
	MgoJy.InitPool()
}

func TestIncluded_GetIncludedData(t *testing.T) {
	type fields struct {
		MysqlDb *mysql.Mysql
		Mgo     *mongodb.MongodbSim
	}
	tests := []struct {
		name    string
		fields  fields
		want    *IncludedData
		wantErr bool
	}{
		// TODO: Add test cases.
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			this := &Included{
				MysqlDb: BaseMysql,
				Mgo:     MgoJy,
			}
			got, err := this.GetIncludedData()
			if (err != nil) != tt.wantErr {
				t.Errorf("GetIncludedData() error = %v, wantErr %v", err, tt.wantErr)
				return
			}
			if !reflect.DeepEqual(got, tt.want) {
				t.Errorf("GetIncludedData() got = %v, want %v", got, tt.want)
			}
		})
	}
}

func Test_formdataNum(t *testing.T) {
	type args struct {
		num int64
	}
	tests := []struct {
		name         string
		args         args
		wantFloatNum float64
		wantUnit     string
	}{
		// TODO: Add test cases.
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			gotFloatNum, gotUnit := formdataNum(tt.args.num)
			if gotFloatNum != tt.wantFloatNum {
				t.Errorf("formdataNum() gotFloatNum = %v, want %v", gotFloatNum, tt.wantFloatNum)
			}
			if gotUnit != tt.wantUnit {
				t.Errorf("formdataNum() gotUnit = %v, want %v", gotUnit, tt.wantUnit)
			}
		})
	}
}
