Skip to content

Go. Bug fixes #2031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions utbot-go/go-samples/simple/nested/nested.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package nested

type unexportedStruct struct {
int
}

type ExportedStruct struct {
unexportedStruct
}
102 changes: 10 additions & 92 deletions utbot-go/go-samples/simple/samples_go_ut_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,69 +46,29 @@ func TestGenerateArrayOfIntegersByUtGoFuzzer(t *testing.T) {
}

func TestDistanceBetweenTwoPointsByUtGoFuzzer(t *testing.T) {
actualVal := DistanceBetweenTwoPoints(Point{x: 0.990722785714783, y: 0.990722785714783}, Point{x: 2.0, y: 2.0})
actualVal := DistanceBetweenTwoPoints(Point{x: 0.730967787376657, y: 0.730967787376657}, Point{x: 2.0, y: 2.0})

assert.Equal(t, 1.4273335246362906, actualVal)
assert.Equal(t, 1.794682566180269, actualVal)
}

func TestGetCoordinatesOfMiddleBetweenTwoPointsByUtGoFuzzer(t *testing.T) {
actualVal0, actualVal1 := GetCoordinatesOfMiddleBetweenTwoPoints(Point{x: 0.4872328470301428, y: 0.4872328470301428}, Point{x: 2.0, y: 2.0})
actualVal0, actualVal1 := GetCoordinatesOfMiddleBetweenTwoPoints(Point{x: 0.24053641567148587, y: 0.24053641567148587}, Point{x: 2.0, y: 2.0})

assertMultiple := assert.New(t)
assertMultiple.Equal(1.2436164235150713, actualVal0)
assertMultiple.Equal(1.2436164235150713, actualVal1)
assertMultiple.Equal(1.1202682078357429, actualVal0)
assertMultiple.Equal(1.1202682078357429, actualVal1)
}

func TestGetCoordinateSumOfPointsByUtGoFuzzer1(t *testing.T) {
actualVal0, actualVal1 := GetCoordinateSumOfPoints([]Point{{x: 0.7462414053223305, y: 0.7462414053223305}})
func TestGetCoordinateSumOfPointsByUtGoFuzzer(t *testing.T) {
actualVal0, actualVal1 := GetCoordinateSumOfPoints([]Point{{x: 0.6374174253501083, y: 0.6374174253501083}})

assertMultiple := assert.New(t)
assertMultiple.Equal(0.7462414053223305, actualVal0)
assertMultiple.Equal(0.7462414053223305, actualVal1)
}

func TestGetCoordinateSumOfPointsByUtGoFuzzer2(t *testing.T) {
actualVal0, actualVal1 := GetCoordinateSumOfPoints([]Point{{x: 0.7462414053223305, y: 0.0}, {x: 0.7462414053223305, y: 0.0}, {x: 0.7462414053223305, y: 2.8480945388892178e-306}, {x: 0.7462414053223305, y: 0.0}})

assertMultiple := assert.New(t)
assertMultiple.Equal(2.984965621289322, actualVal0)
assertMultiple.Equal(2.8480945388892178e-306, actualVal1)
}

func TestGetCoordinateSumOfPointsByUtGoFuzzer3(t *testing.T) {
actualVal0, actualVal1 := GetCoordinateSumOfPoints([]Point{{x: 0.7462414053223305, y: 0.7462414053223305}, {x: 0.0, y: 0.7462414053223305}})

assertMultiple := assert.New(t)
assertMultiple.Equal(0.7462414053223305, actualVal0)
assertMultiple.Equal(1.492482810644661, actualVal1)
}

func TestGetCoordinateSumOfPointsByUtGoFuzzer4(t *testing.T) {
actualVal0, actualVal1 := GetCoordinateSumOfPoints([]Point{{x: 0.0, y: 0.0}, {x: 0.0, y: 0.0}, {x: 0.0, y: 0.0}})

assertMultiple := assert.New(t)
assertMultiple.Equal(0.0, actualVal0)
assertMultiple.Equal(0.0, actualVal1)
}

func TestGetCoordinateSumOfPointsByUtGoFuzzer5(t *testing.T) {
actualVal0, actualVal1 := GetCoordinateSumOfPoints([]Point{{x: 0.0, y: 0.7462414053223305}, {x: 0.0, y: 0.7462414053223305}, {x: 4.7783097267364807e-299, y: 0.7462414053223305}, {x: 0.0, y: 0.7462414053223305}, {x: 0.0, y: 0.7462414053223305}})

assertMultiple := assert.New(t)
assertMultiple.Equal(4.7783097267364807e-299, actualVal0)
assertMultiple.Equal(3.731207026611653, actualVal1)
}

func TestGetCoordinateSumOfPointsByUtGoFuzzer6(t *testing.T) {
actualVal0, actualVal1 := GetCoordinateSumOfPoints([]Point{})

assertMultiple := assert.New(t)
assertMultiple.Equal(0.0, actualVal0)
assertMultiple.Equal(0.0, actualVal1)
assertMultiple.Equal(0.6374174253501083, actualVal0)
assertMultiple.Equal(0.6374174253501083, actualVal1)
}

func TestGetAreaOfCircleByUtGoFuzzer(t *testing.T) {
actualVal := GetAreaOfCircle(Circle{Center: Point{x: 0.7331520701949938, y: 0.7331520701949938}, Radius: 2.0})
actualVal := GetAreaOfCircle(Circle{Center: Point{x: 0.5504370051176339, y: 0.5504370051176339}, Radius: 2.0})

assert.Equal(t, 12.566370614359172, actualVal)
}
Expand All @@ -126,48 +86,6 @@ func TestIsIdentityByUtGoFuzzer2(t *testing.T) {
}

func TestIsIdentityByUtGoFuzzer3(t *testing.T) {
actualVal := IsIdentity([3][3]int{{1, 0, 0}, {0, 0, 0}, {0, 0, 0}})

assert.Equal(t, false, actualVal)
}

func TestIsIdentityByUtGoFuzzer4(t *testing.T) {
actualVal := IsIdentity([3][3]int{{1, 0, 1}, {1, 0, 1}, {0, 1, 1}})

assert.Equal(t, false, actualVal)
}

func TestIsIdentityByUtGoFuzzer5(t *testing.T) {
actualVal := IsIdentity([3][3]int{{1, 0, 0}, {0, 1, 2048}, {0, 0, 0}})

assert.Equal(t, false, actualVal)
}

func TestIsIdentityByUtGoFuzzer6(t *testing.T) {
actualVal := IsIdentity([3][3]int{{1, 0, 0}, {2199023255552, 1, 2048}, {0, 0, 3}})

assert.Equal(t, false, actualVal)
}

func TestIsIdentityByUtGoFuzzer7(t *testing.T) {
actualVal := IsIdentity([3][3]int{{1, 0, 0}, {0, 1, 0}, {0, 0, 0}})

assert.Equal(t, false, actualVal)
}

func TestIsIdentityByUtGoFuzzer8(t *testing.T) {
actualVal := IsIdentity([3][3]int{{1, 0, 0}, {0, 1, 0}, {0, 1, 0}})

assert.Equal(t, false, actualVal)
}

func TestIsIdentityByUtGoFuzzer9(t *testing.T) {
actualVal := IsIdentity([3][3]int{{1, 0, 0}, {0, 1, 0}, {18014398509481984, 1, 0}})

assert.Equal(t, false, actualVal)
}

func TestIsIdentityByUtGoFuzzer10(t *testing.T) {
actualVal := IsIdentity([3][3]int{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}})

assert.Equal(t, true, actualVal)
Expand Down
5 changes: 5 additions & 0 deletions utbot-go/go-samples/simple/supported_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"github.com/pmezard/go-difflib/difflib"
dif "github.com/pmezard/go-difflib/difflib"
"go-samples/simple/nested"
"math"
)

Expand Down Expand Up @@ -214,3 +215,7 @@ func SliceOfSliceOfStructs(slice [][]Structure) [][]Structure {
func SliceOfArrayOfInt(slice [][5]int) [][5]int {
return slice
}

func ExportedStructWithEmbeddedUnexportedStruct(exportedStruct nested.ExportedStruct) nested.ExportedStruct {
return exportedStruct
}
Loading