From 45c59133ef92096c1cc020a226024b032f7da67e Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 19 Jun 2013 09:33:26 +0900 Subject: [PATCH] Bug fix: test --- graphics/affine_matrix_test.go | 22 +++++++++++----------- graphics/geometry_matrix_test.go | 12 ++++++------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/graphics/affine_matrix_test.go b/graphics/affine_matrix_test.go index 1aaea242a..39a727f30 100644 --- a/graphics/affine_matrix_test.go +++ b/graphics/affine_matrix_test.go @@ -5,7 +5,7 @@ import ( . "." ) -func setElements(matrix *AffineMatrix, elements [][]AffineMatrixElement) { +func setElements(matrix *AffineMatrix, elements [][]float64) { dimension := len(elements) + 1 for i := 0; i < dimension-1; i++ { for j := 0; j < dimension; j++ { @@ -19,7 +19,7 @@ func TestAffineMatrixElement(t *testing.T) { matrix.SetElement(0, 0, 1) matrix.SetElement(0, 1, 2) matrix.SetElement(0, 2, 3) - expected := [][]AffineMatrixElement{ + expected := [][]float64{ {1, 2, 3, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, @@ -39,7 +39,7 @@ func TestAffineMatrixElement(t *testing.T) { matrix.SetElement(1, 0, 4) matrix.SetElement(1, 1, 5) matrix.SetElement(2, 3, 6) - expected = [][]AffineMatrixElement{ + expected = [][]float64{ {1, 2, 3, 0}, {4, 5, 0, 0}, {0, 0, 0, 6}, @@ -86,18 +86,18 @@ func TestAffineMatrixIsIdentity(t *testing.T) { func TestAffineMatrixConcat(t *testing.T) { matrix1 := IdentityAffineMatrix(3) matrix2 := IdentityAffineMatrix(3) - setElements(matrix1, [][]AffineMatrixElement{ + setElements(matrix1, [][]float64{ {2, 0, 0}, {0, 2, 0}, }) - setElements(matrix2, [][]AffineMatrixElement{ + setElements(matrix2, [][]float64{ {1, 0, 1}, {0, 1, 1}, }) // TODO: 'matrix1x2' may not be a good name. matrix1x2 := matrix1.Concat(matrix2) - expected := [][]AffineMatrixElement{ + expected := [][]float64{ {2, 0, 1}, {0, 2, 1}, {0, 0, 1}, @@ -114,7 +114,7 @@ func TestAffineMatrixConcat(t *testing.T) { } matrix2x1 := matrix2.Concat(matrix1) - expected = [][]AffineMatrixElement{ + expected = [][]float64{ {2, 0, 2}, {0, 2, 2}, {0, 0, 1}, @@ -132,19 +132,19 @@ func TestAffineMatrixConcat(t *testing.T) { matrix3 := NewAffineMatrix(4) matrix4 := NewAffineMatrix(4) - setElements(matrix3, [][]AffineMatrixElement{ + setElements(matrix3, [][]float64{ {1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, }) - setElements(matrix4, [][]AffineMatrixElement{ + setElements(matrix4, [][]float64{ {13, 14, 15, 16}, {17, 18, 19, 20}, {21, 22, 23, 24}, }) matrix3x4 := matrix3.Concat(matrix4) - expected = [][]AffineMatrixElement{ + expected = [][]float64{ {218, 260, 302, 360}, {278, 332, 386, 460}, {338, 404, 470, 560}, @@ -161,7 +161,7 @@ func TestAffineMatrixConcat(t *testing.T) { } matrix4x3 := matrix4.Concat(matrix3) - expected = [][]AffineMatrixElement{ + expected = [][]float64{ {110, 116, 122, 132}, {314, 332, 350, 376}, {518, 548, 578, 620}, diff --git a/graphics/geometry_matrix_test.go b/graphics/geometry_matrix_test.go index d842df508..45cd7690d 100644 --- a/graphics/geometry_matrix_test.go +++ b/graphics/geometry_matrix_test.go @@ -15,37 +15,37 @@ func TestGeometryMatrixElements(t *testing.T) { matrix.SetTy(6) got := matrix.A() - want := AffineMatrixElement(1) + want := float64(1) if want != got { t.Errorf("matrix.A() = %f, want %f", got, want) } got = matrix.B() - want = AffineMatrixElement(2) + want = float64(2) if want != got { t.Errorf("matrix.B() = %f, want %f", got, want) } got = matrix.C() - want = AffineMatrixElement(3) + want = float64(3) if want != got { t.Errorf("matrix.C() = %f, want %f", got, want) } got = matrix.D() - want = AffineMatrixElement(4) + want = float64(4) if want != got { t.Errorf("matrix.D() = %f, want %f", got, want) } got = matrix.Tx() - want = AffineMatrixElement(5) + want = float64(5) if want != got { t.Errorf("matrix.Tx() = %f, want %f", got, want) } got = matrix.Ty() - want = AffineMatrixElement(6) + want = float64(6) if want != got { t.Errorf("matrix.Ty() = %f, want %f", got, want) }