-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
82 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package cyclinganalytics_test | ||
|
||
import ( | ||
"bytes" | ||
"encoding/json" | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
"github.com/bzimmer/activity/cyclinganalytics" | ||
) | ||
|
||
func TestModel(t *testing.T) { | ||
t.Parallel() | ||
a := assert.New(t) | ||
|
||
tests := []struct { | ||
name string | ||
}{ | ||
{ | ||
name: "success", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
tt := tt | ||
t.Run(tt.name, func(t *testing.T) { | ||
src := cyclinganalytics.Ride{ | ||
UTCDatetime: cyclinganalytics.Datetime{Time: time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)}, | ||
} | ||
var buf bytes.Buffer | ||
enc := json.NewEncoder(&buf) | ||
a.NoError(enc.Encode(src)) | ||
var dst cyclinganalytics.Ride | ||
dec := json.NewDecoder(&buf) | ||
a.NoError(dec.Decode(&dst)) | ||
a.Equal(src.UTCDatetime, dst.UTCDatetime) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package zwift_test | ||
|
||
import ( | ||
"bytes" | ||
"encoding/json" | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
"github.com/bzimmer/activity/zwift" | ||
) | ||
|
||
func TestModel(t *testing.T) { | ||
t.Parallel() | ||
a := assert.New(t) | ||
|
||
tests := []struct { | ||
name string | ||
}{ | ||
{ | ||
name: "success", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
tt := tt | ||
t.Run(tt.name, func(t *testing.T) { | ||
src := zwift.Activity{ | ||
StartDate: zwift.Datetime{Time: time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)}, | ||
} | ||
var buf bytes.Buffer | ||
enc := json.NewEncoder(&buf) | ||
a.NoError(enc.Encode(src)) | ||
var dst zwift.Activity | ||
dec := json.NewDecoder(&buf) | ||
a.NoError(dec.Decode(&dst)) | ||
a.Equal(src.StartDate, dst.StartDate) | ||
}) | ||
} | ||
} |