Skip to content

Commit

Permalink
videocore: add simple unit test
Browse files Browse the repository at this point in the history
This is primarily to confirm that this works around a bug in rsc.io/gt.
  • Loading branch information
maruel committed Apr 9, 2017
1 parent 543e702 commit 6cdf1cc
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions host/videocore/videocore_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2017 The Periph Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.

package videocore

import "testing"

func TestGenPacket(t *testing.T) {
actual := genPacket(10, 12, 1, 2, 3)
expected := []uint32{0x24, 0x0, 0xa, 0xc, 0xc, 0x1, 0x2, 0x3, 0x0}
if !uint32Equals(actual, expected) {
t.Fatal(actual)
}
}

func uint32Equals(a []uint32, b []uint32) bool {
if len(a) != len(b) {
return false
}
for i, v := range a {
if v != b[i] {
return false
}
}
return true
}

0 comments on commit 6cdf1cc

Please sign in to comment.