Skip to content

Commit

Permalink
update tests to match code style
Browse files Browse the repository at this point in the history
  • Loading branch information
ddaniel27 committed Sep 25, 2024
1 parent 495cff8 commit 301151e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
7 changes: 2 additions & 5 deletions dynamic/subsetsum_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package dynamic

import (
"fmt"
"testing"
)
import "testing"

func TestSubsetSum(t *testing.T) {

Expand Down Expand Up @@ -74,7 +71,7 @@ func TestSubsetSum(t *testing.T) {

for i := range subsetSumTestData {

t.Run(fmt.Sprintf(subsetSumTestData[i].description), func(t *testing.T) {
t.Run(subsetSumTestData[i].description, func(t *testing.T) {
array := subsetSumTestData[i].array
sum := subsetSumTestData[i].sum

Expand Down
4 changes: 2 additions & 2 deletions math/matrix/matrix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestNewFromElements(t *testing.T) {
for j := 0; j < len(validElements[0]); j++ {
err := expectedm1.Set(i, j, validElements[i][j])
if err != nil {
t.Errorf("copyMatrix.Set error: " + err.Error())
t.Errorf("copyMatrix.Set error: %s", err.Error())
}
}
}
Expand Down Expand Up @@ -73,7 +73,7 @@ func TestMatrixGet(t *testing.T) {
matrix := matrix.New(3, 3, 0)
err := matrix.Set(1, 1, 42) // Set a specific value for testing
if err != nil {
t.Errorf("copyMatrix.Set error: " + err.Error())
t.Errorf("copyMatrix.Set error: %s", err.Error())
}
// Test case 1: Valid Get
val1, err1 := matrix.Get(1, 1)
Expand Down
4 changes: 2 additions & 2 deletions math/matrix/strassenmatrixmultiply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestStrassenMatrixMultiply(t *testing.T) {
}
}
func TestMatrixMultiplication(t *testing.T) {
rand.Seed(time.Now().UnixNano())
rand.New(rand.NewSource(time.Now().UnixNano()))

// Generate random matrices for testing
size := 1 << (rand.Intn(8) + 1) // tests for matrix with n as power of 2
Expand Down Expand Up @@ -103,7 +103,7 @@ func TestMatrixMultiplication(t *testing.T) {
}

func MakeRandomMatrix[T constraints.Integer](rows, columns int) matrix.Matrix[T] {
rand.Seed(time.Now().UnixNano())
rand.New(rand.NewSource(time.Now().UnixNano()))

matrixData := make([][]T, rows)
for i := 0; i < rows; i++ {
Expand Down

0 comments on commit 301151e

Please sign in to comment.