Skip to content

Go. Assertions for structures should be accurate #1809

Open
@alisevych

Description

@alisevych

Description

Now tests generated for Go structures have assertNotEquals for the whole structure.
Actual and expected structures have only one different field.
If some other field is different in actual and expected structures, the test will pass too.

Context

for example:
utbot-go/go-samples/simple/supported_types_go_ut_test.go see TestStructWithNanByUtGoFuzzer

Actual behavior

assert.NotEqual(t, Structure{int: -1, int8: 1, int16: 32767, int32: -1, int64: -1, uint: 18446744073709551615, uint8: 0, uint16: 1, uint32: 0, uint64: 18446744073709551615, uintptr: 18446744073709551615, float32: 0.02308184, float64: math.NaN(), complex64: complex(float32(0.02308184), float32(0.02308184)), complex128: complex(0.9412491794821144, 0.9412491794821144), byte: 0, rune: -1, string: "", bool: false}, actualVal)

Expected behavior

assert.NotEqual(t, math.NaN(), actualVal.float64)

Environment

IntelliJ IDEA 2022.1 - 2022.2 Ultimate/Community
GoLand 2022.2

Metadata

Metadata

Assignees

Labels

ctg-bugIssue is a bugctg-questionFurther information is requestedlang-goIssue is related to Go support

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions