From 646d464e731eee557e49f469f7adcc2a321c608e Mon Sep 17 00:00:00 2001 From: raspi Date: Tue, 31 Dec 2019 14:45:38 +0200 Subject: [PATCH] not used --- pkg/display/funcs.go | 21 ---------- pkg/display/nearest_test.go | 78 ------------------------------------- 2 files changed, 99 deletions(-) delete mode 100644 pkg/display/nearest_test.go diff --git a/pkg/display/funcs.go b/pkg/display/funcs.go index 5f74986..4659ef2 100644 --- a/pkg/display/funcs.go +++ b/pkg/display/funcs.go @@ -2,27 +2,6 @@ package display import "fmt" -/* -nearest returns nearest bits to uint8-64 len - -1-7 = 8 -9-15 = 16 - -and so on -*/ -func nearest(bitWidth uint8) uint8 { - if bitWidth > 64 { - return 64 - } else if bitWidth > 32 { - return 64 - } else if bitWidth > 16 { - return 32 - } else if bitWidth > 8 { - return 16 - } - return 8 -} - // header returns header for formatters of different lengths // for example: // - bit formatter displays 8 characters (00000000-11111111) diff --git a/pkg/display/nearest_test.go b/pkg/display/nearest_test.go deleted file mode 100644 index b9a948f..0000000 --- a/pkg/display/nearest_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package display - -import "testing" - -func TestNearest(t *testing.T) { - - type test struct { - Width uint8 - Expected uint8 - Actual uint8 - } - - tests := []test{ - { - Width: 1, - Expected: 8, - }, - { - Width: 7, - Expected: 8, - }, - { - Width: 8, - Expected: 8, - }, - { - Width: 9, - Expected: 16, - }, - { - Width: 15, - Expected: 16, - }, - { - Width: 16, - Expected: 16, - }, - { - Width: 17, - Expected: 32, - }, - { - Width: 31, - Expected: 32, - }, - { - Width: 32, - Expected: 32, - }, - { - Width: 33, - Expected: 64, - }, - { - Width: 63, - Expected: 64, - }, - { - Width: 64, - Expected: 64, - }, - } - - failed := false - - for _, tst := range tests { - tst.Actual = nearest(tst.Width) - if tst.Actual != tst.Expected { - t.Logf(`expected %d got %d`, tst.Expected, tst.Actual) - failed = true - } - } - - if failed { - t.Fail() - } - -}