aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2023-05-18 11:25:44 +0100
committerGitHub <noreply@github.com>2023-05-18 11:25:44 +0100
commit5ec47191240c19e32c2db273a1cfc83c0cdc5ff8 (patch)
tree5dff4d53e80eff684f7935c1c18cf38dcded1f0a /tests
parent911c98e2351c1b0d27b63ef51184b72e5903c4fd (diff)
parentada42aa18441584d503eaa88f08a895be4284015 (diff)
Merge pull request #2523 from jcmoyer/fix-2056
Zero non-diagonal elements when converting to matrix
Diffstat (limited to 'tests')
-rw-r--r--tests/issues/run.bat1
-rwxr-xr-xtests/issues/run.sh1
-rw-r--r--tests/issues/test_issue_2056.odin22
3 files changed, 24 insertions, 0 deletions
diff --git a/tests/issues/run.bat b/tests/issues/run.bat
index ea5feddaa..87492bc29 100644
--- a/tests/issues/run.bat
+++ b/tests/issues/run.bat
@@ -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
diff --git a/tests/issues/run.sh b/tests/issues/run.sh
index 440c953d9..f894f2dae 100755
--- a/tests/issues/run.sh
+++ b/tests/issues/run.sh
@@ -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
diff --git a/tests/issues/test_issue_2056.odin b/tests/issues/test_issue_2056.odin
new file mode 100644
index 000000000..4869b557e
--- /dev/null
+++ b/tests/issues/test_issue_2056.odin
@@ -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]))
+ }
+ }
+ }
+}
+