@@ -21,7 +21,7 @@ func newFloat(f float64) *float64 {
21
21
22
22
// Test
23
23
func (suite * OcppV16TestSuite ) TestIdTagInfoValidation () {
24
- var testTable = []GenericTestEntry {
24
+ testTable : = []GenericTestEntry {
25
25
{types.IdTagInfo {ExpiryDate : types .NewDateTime (time .Now ()), ParentIdTag : "00000" , Status : types .AuthorizationStatusAccepted }, true },
26
26
{types.IdTagInfo {ExpiryDate : types .NewDateTime (time .Now ()), Status : types .AuthorizationStatusAccepted }, true },
27
27
{types.IdTagInfo {Status : types .AuthorizationStatusAccepted }, true },
@@ -38,7 +38,7 @@ func (suite *OcppV16TestSuite) TestIdTagInfoValidation() {
38
38
39
39
func (suite * OcppV16TestSuite ) TestChargingSchedulePeriodValidation () {
40
40
t := suite .T ()
41
- var testTable = []GenericTestEntry {
41
+ testTable : = []GenericTestEntry {
42
42
{types.ChargingSchedulePeriod {StartPeriod : 0 , Limit : 10.0 , NumberPhases : newInt (3 )}, true },
43
43
{types.ChargingSchedulePeriod {StartPeriod : 0 , Limit : 10.0 }, true },
44
44
{types.ChargingSchedulePeriod {StartPeriod : 0 }, true },
@@ -55,7 +55,7 @@ func (suite *OcppV16TestSuite) TestChargingScheduleValidation() {
55
55
chargingSchedulePeriods := make ([]types.ChargingSchedulePeriod , 2 )
56
56
chargingSchedulePeriods [0 ] = types .NewChargingSchedulePeriod (0 , 10.0 )
57
57
chargingSchedulePeriods [1 ] = types .NewChargingSchedulePeriod (100 , 8.0 )
58
- var testTable = []GenericTestEntry {
58
+ testTable : = []GenericTestEntry {
59
59
{types.ChargingSchedule {Duration : newInt (0 ), StartSchedule : types .NewDateTime (time .Now ()), ChargingRateUnit : types .ChargingRateUnitWatts , ChargingSchedulePeriod : chargingSchedulePeriods , MinChargingRate : newFloat (1.0 )}, true },
60
60
{types.ChargingSchedule {Duration : newInt (0 ), ChargingRateUnit : types .ChargingRateUnitWatts , ChargingSchedulePeriod : chargingSchedulePeriods , MinChargingRate : newFloat (1.0 )}, true },
61
61
{types.ChargingSchedule {Duration : newInt (0 ), ChargingRateUnit : types .ChargingRateUnitWatts , ChargingSchedulePeriod : chargingSchedulePeriods }, true },
@@ -72,7 +72,7 @@ func (suite *OcppV16TestSuite) TestChargingScheduleValidation() {
72
72
func (suite * OcppV16TestSuite ) TestChargingProfileValidation () {
73
73
t := suite .T ()
74
74
chargingSchedule := types .NewChargingSchedule (types .ChargingRateUnitWatts , types .NewChargingSchedulePeriod (0 , 10.0 ), types .NewChargingSchedulePeriod (100 , 8.0 ))
75
- var testTable = []GenericTestEntry {
75
+ testTable : = []GenericTestEntry {
76
76
{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 },
77
77
{types.ChargingProfile {ChargingProfileId : 1 , StackLevel : 1 , ChargingProfilePurpose : types .ChargingProfilePurposeChargePointMaxProfile , ChargingProfileKind : types .ChargingProfileKindAbsolute , ChargingSchedule : chargingSchedule }, true },
78
78
{types.ChargingProfile {ChargingProfileId : 1 , StackLevel : 1 , ChargingProfilePurpose : types .ChargingProfilePurposeChargePointMaxProfile , ChargingProfileKind : types .ChargingProfileKindAbsolute }, false },
@@ -91,7 +91,7 @@ func (suite *OcppV16TestSuite) TestChargingProfileValidation() {
91
91
92
92
func (suite * OcppV16TestSuite ) TestSampledValueValidation () {
93
93
t := suite .T ()
94
- var testTable = []GenericTestEntry {
94
+ testTable : = []GenericTestEntry {
95
95
{types.SampledValue {Value : "value" , Context : types .ReadingContextTransactionEnd , Format : types .ValueFormatRaw , Measurand : types .MeasurandPowerActiveExport , Phase : types .PhaseL2 , Location : types .LocationBody , Unit : types .UnitOfMeasureKW }, true },
96
96
{types.SampledValue {Value : "value" , Context : types .ReadingContextTransactionEnd , Format : types .ValueFormatRaw , Measurand : types .MeasurandPowerActiveExport , Phase : types .PhaseL2 , Location : types .LocationBody }, true },
97
97
{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() {
110
110
}
111
111
112
112
func (suite * OcppV16TestSuite ) TestMeterValueValidation () {
113
- var testTable = []GenericTestEntry {
113
+ testTable : = []GenericTestEntry {
114
114
{types.MeterValue {Timestamp : types .NewDateTime (time .Now ()), SampledValue : []types.SampledValue {{Value : "value" }, {Value : "value2" , Unit : types .UnitOfMeasureKW }}}, true },
115
115
{types.MeterValue {Timestamp : types .NewDateTime (time .Now ()), SampledValue : []types.SampledValue {{Value : "value" }}}, true },
116
116
{types.MeterValue {Timestamp : types .NewDateTime (time .Now ()), SampledValue : []types.SampledValue {}}, false },
@@ -180,5 +180,5 @@ func (suite *OcppV16TestSuite) TestMarshalDateTime() {
180
180
func (suite * OcppV16TestSuite ) TestNowDateTime () {
181
181
now := types .Now ()
182
182
suite .NotNil (now )
183
- suite .True (time .Now (). Sub (now .Time ) < 1 * time .Second )
183
+ suite .True (time .Since (now .Time ) < 1 * time .Second )
184
184
}
0 commit comments