Add test for issue #2056

This commit is contained in:
J.C. Moyer
2023-05-09 12:37:12 -04:00
parent ed580b3060
commit ada42aa184
3 changed files with 24 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ set COMMON=-collection:tests=..\..
..\..\..\odin test ..\test_issue_829.odin %COMMON% -file || exit /b
..\..\..\odin test ..\test_issue_1592.odin %COMMON% -file || exit /b
..\..\..\odin test ..\test_issue_2056.odin %COMMON% -file || exit /b
..\..\..\odin test ..\test_issue_2087.odin %COMMON% -file || exit /b
..\..\..\odin build ..\test_issue_2113.odin %COMMON% -file -debug || exit /b

View File

@@ -10,6 +10,7 @@ set -x
$ODIN test ../test_issue_829.odin $COMMON -file
$ODIN test ../test_issue_1592.odin $COMMON -file
$ODIN test ../test_issue_2056.odin $COMMON -file
$ODIN test ../test_issue_2087.odin $COMMON -file
$ODIN build ../test_issue_2113.odin $COMMON -file -debug

View File

@@ -0,0 +1,22 @@
// Tests issue #2056 https://github.com/odin-lang/Odin/issues/2056
package test_issues
import "core:fmt"
import "core:testing"
@test
test_scalar_matrix_conversion :: proc(t: ^testing.T) {
l := f32(1.0)
m := (matrix[4,4]f32)(l)
for i in 0..<4 {
for j in 0..<4 {
if i == j {
testing.expect(t, m[i,j] == 1, fmt.tprintf("expected 1 at m[%d,%d], found %f\n", i, j, m[i,j]))
} else {
testing.expect(t, m[i,j] == 0, fmt.tprintf("expected 0 at m[%d,%d], found %f\n", i, j, m[i,j]))
}
}
}
}