1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-19 08:30:25 +02:00

Improved numeric handling on types with numeric conversion ops

This commit is contained in:
Brian Fiete 2022-05-15 17:56:39 -07:00
parent 2aaf5a2db4
commit 75107a947c
5 changed files with 176 additions and 11 deletions

View file

@ -1,3 +1,5 @@
#pragma warning disable 168
using System;
using System.Numerics;
@ -21,6 +23,22 @@ namespace Tests
float4 v3 = v0.wzyx;
Test.Assert(v3 === .(4, 3, 2, 1));
Result<uint16> r0 = 123;
Result<int16> r1 = 2000;
Result<uint32> r2 = 3000;
uint16 v4 = r0 + 123;
var v5 = r0 + 2;
Test.Assert(v5.GetType() == typeof(uint16));
var v6 = r0 + r0;
Test.Assert(v6.GetType() == typeof(uint16));
var v7 = r0 + r1;
Test.Assert(v7.GetType() == typeof(int));
var v8 = r0 + r2;
Test.Assert(v8.GetType() == typeof(uint32));
var v9 = r2 + r0;
Test.Assert(v9.GetType() == typeof(uint32));
}
}
}