@@ -21,7 +21,7 @@ func newFloat(f float64) *float64 {
2121
2222// Test
2323func (suite * OcppV16TestSuite ) TestIdTagInfoValidation () {
24- var testTable = []GenericTestEntry {
24+ testTable : = []GenericTestEntry {
2525 {types.IdTagInfo {ExpiryDate : types .NewDateTime (time .Now ()), ParentIdTag : "00000" , Status : types .AuthorizationStatusAccepted }, true },
2626 {types.IdTagInfo {ExpiryDate : types .NewDateTime (time .Now ()), Status : types .AuthorizationStatusAccepted }, true },
2727 {types.IdTagInfo {Status : types .AuthorizationStatusAccepted }, true },
@@ -38,7 +38,7 @@ func (suite *OcppV16TestSuite) TestIdTagInfoValidation() {
3838
3939func (suite * OcppV16TestSuite ) TestChargingSchedulePeriodValidation () {
4040 t := suite .T ()
41- var testTable = []GenericTestEntry {
41+ testTable : = []GenericTestEntry {
4242 {types.ChargingSchedulePeriod {StartPeriod : 0 , Limit : 10.0 , NumberPhases : newInt (3 )}, true },
4343 {types.ChargingSchedulePeriod {StartPeriod : 0 , Limit : 10.0 }, true },
4444 {types.ChargingSchedulePeriod {StartPeriod : 0 }, true },
@@ -55,7 +55,7 @@ func (suite *OcppV16TestSuite) TestChargingScheduleValidation() {
5555 chargingSchedulePeriods := make ([]types.ChargingSchedulePeriod , 2 )
5656 chargingSchedulePeriods [0 ] = types .NewChargingSchedulePeriod (0 , 10.0 )
5757 chargingSchedulePeriods [1 ] = types .NewChargingSchedulePeriod (100 , 8.0 )
58- var testTable = []GenericTestEntry {
58+ testTable : = []GenericTestEntry {
5959 {types.ChargingSchedule {Duration : newInt (0 ), StartSchedule : types .NewDateTime (time .Now ()), ChargingRateUnit : types .ChargingRateUnitWatts , ChargingSchedulePeriod : chargingSchedulePeriods , MinChargingRate : newFloat (1.0 )}, true },
6060 {types.ChargingSchedule {Duration : newInt (0 ), ChargingRateUnit : types .ChargingRateUnitWatts , ChargingSchedulePeriod : chargingSchedulePeriods , MinChargingRate : newFloat (1.0 )}, true },
6161 {types.ChargingSchedule {Duration : newInt (0 ), ChargingRateUnit : types .ChargingRateUnitWatts , ChargingSchedulePeriod : chargingSchedulePeriods }, true },
@@ -72,7 +72,7 @@ func (suite *OcppV16TestSuite) TestChargingScheduleValidation() {
7272func (suite * OcppV16TestSuite ) TestChargingProfileValidation () {
7373 t := suite .T ()
7474 chargingSchedule := types .NewChargingSchedule (types .ChargingRateUnitWatts , types .NewChargingSchedulePeriod (0 , 10.0 ), types .NewChargingSchedulePeriod (100 , 8.0 ))
75- var testTable = []GenericTestEntry {
75+ testTable : = []GenericTestEntry {
7676 {types.ChargingProfile {ChargingProfileId : 1 , TransactionId : 1 , StackLevel : 1 , ChargingProfilePurpose : types .ChargingProfilePurposeChargePointMaxProfile , ChargingProfileKind : types .ChargingProfileKindAbsolute , RecurrencyKind : types .RecurrencyKindDaily , ValidFrom : types .NewDateTime (time .Now ()), ValidTo : types .NewDateTime (time .Now ().Add (8 * time .Hour )), ChargingSchedule : chargingSchedule }, true },
7777 {types.ChargingProfile {ChargingProfileId : 1 , StackLevel : 1 , ChargingProfilePurpose : types .ChargingProfilePurposeChargePointMaxProfile , ChargingProfileKind : types .ChargingProfileKindAbsolute , ChargingSchedule : chargingSchedule }, true },
7878 {types.ChargingProfile {ChargingProfileId : 1 , StackLevel : 1 , ChargingProfilePurpose : types .ChargingProfilePurposeChargePointMaxProfile , ChargingProfileKind : types .ChargingProfileKindAbsolute }, false },
@@ -91,7 +91,7 @@ func (suite *OcppV16TestSuite) TestChargingProfileValidation() {
9191
9292func (suite * OcppV16TestSuite ) TestSampledValueValidation () {
9393 t := suite .T ()
94- var testTable = []GenericTestEntry {
94+ testTable : = []GenericTestEntry {
9595 {types.SampledValue {Value : "value" , Context : types .ReadingContextTransactionEnd , Format : types .ValueFormatRaw , Measurand : types .MeasurandPowerActiveExport , Phase : types .PhaseL2 , Location : types .LocationBody , Unit : types .UnitOfMeasureKW }, true },
9696 {types.SampledValue {Value : "value" , Context : types .ReadingContextTransactionEnd , Format : types .ValueFormatRaw , Measurand : types .MeasurandPowerActiveExport , Phase : types .PhaseL2 , Location : types .LocationBody }, true },
9797 {types.SampledValue {Value : "value" , Context : types .ReadingContextTransactionEnd , Format : types .ValueFormatRaw , Measurand : types .MeasurandPowerActiveExport , Phase : types .PhaseL2 }, true },
@@ -110,7 +110,7 @@ func (suite *OcppV16TestSuite) TestSampledValueValidation() {
110110}
111111
112112func (suite * OcppV16TestSuite ) TestMeterValueValidation () {
113- var testTable = []GenericTestEntry {
113+ testTable : = []GenericTestEntry {
114114 {types.MeterValue {Timestamp : types .NewDateTime (time .Now ()), SampledValue : []types.SampledValue {{Value : "value" }, {Value : "value2" , Unit : types .UnitOfMeasureKW }}}, true },
115115 {types.MeterValue {Timestamp : types .NewDateTime (time .Now ()), SampledValue : []types.SampledValue {{Value : "value" }}}, true },
116116 {types.MeterValue {Timestamp : types .NewDateTime (time .Now ()), SampledValue : []types.SampledValue {}}, false },
@@ -180,5 +180,5 @@ func (suite *OcppV16TestSuite) TestMarshalDateTime() {
180180func (suite * OcppV16TestSuite ) TestNowDateTime () {
181181 now := types .Now ()
182182 suite .NotNil (now )
183- suite .True (time .Now (). Sub (now .Time ) < 1 * time .Second )
183+ suite .True (time .Since (now .Time ) < 1 * time .Second )
184184}
0 commit comments