tests, load materials start
This commit is contained in:
@ -2,9 +2,13 @@ package itemprops
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/stretchr/testify/suite"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
type IpTestSuite struct {
|
||||
@ -173,3 +177,32 @@ func (suite *IpTestSuite) TestMaterialSerialization() {
|
||||
string(bytes),
|
||||
)
|
||||
}
|
||||
|
||||
func (suite *IpTestSuite) TestMaterialDeserialization() {
|
||||
|
||||
logger := log.Output(zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.RFC3339})
|
||||
mm, err := NewMaterialMap("../../..", logger)
|
||||
suite.NoError(err)
|
||||
|
||||
metalMaterialFlags := MaterialFlags{
|
||||
ConductsElictricity: true,
|
||||
BlocksLiquid: true,
|
||||
AcidResistant: true,
|
||||
BlocksGas: true,
|
||||
Flammable: false,
|
||||
ConductsHeat: true,
|
||||
Radiates: true,
|
||||
}
|
||||
|
||||
teststeel := Material{
|
||||
Name: "teststeel",
|
||||
Flags: metalMaterialFlags,
|
||||
Density: DimensionItemDensity{decimal.NewFromInt(7800)},
|
||||
FractureToughness: DimensionFractureToughness{decimal.NewFromInt(30)},
|
||||
MeltingPoint: DimensionItemNullTemperature{decimal.NullDecimal{decimal.NewFromInt(1400), true}},
|
||||
BoilingPoint: DimensionItemNullTemperature{decimal.NullDecimal{decimal.NewFromInt(3200), true}},
|
||||
}
|
||||
|
||||
_ = teststeel
|
||||
_ = mm
|
||||
}
|
||||
|
Reference in New Issue
Block a user