mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
First 0.7 update, removing all deprecated features.
This commit is contained in:
committed by
Christoffer Lerno
parent
cff6697818
commit
2a895ec7be
@@ -1,17 +1,17 @@
|
||||
module math_tests @test;
|
||||
import math_tests::complex;
|
||||
|
||||
def ComplexDouble = ComplexType(<double>) @local;
|
||||
def ComplexInt = ComplexType(<int>) @local;
|
||||
def ComplexDouble = ComplexType{double} @local;
|
||||
def ComplexInt = ComplexType{int} @local;
|
||||
|
||||
module math_tests::complex(<ElementType>) @test;
|
||||
module math_tests::complex{ElementType} @test;
|
||||
import std::math;
|
||||
|
||||
def ComplexType = Complex(<ElementType>);
|
||||
def ComplexType = Complex{ElementType};
|
||||
|
||||
fn void complex_mul_imaginary()
|
||||
{
|
||||
ComplexType i = complex::IMAGINARY(<ElementType>);
|
||||
ComplexType i = complex::IMAGINARY{ElementType};
|
||||
assert(i.mul(i).equals((ComplexType){-1, 0}));
|
||||
assert(i.mul(i).mul(i).equals((ComplexType){0, -1}));
|
||||
}
|
||||
@@ -47,7 +47,7 @@ fn void complex_conjugate()
|
||||
fn void complex_inverse() @if(types::is_float(ElementType))
|
||||
{
|
||||
ComplexType a = {3, 4};
|
||||
assert(a.inverse().mul(a).equals(complex::IDENTITY(<ElementType>)));
|
||||
assert(a.inverse().mul(a).equals(complex::IDENTITY{ElementType}));
|
||||
}
|
||||
|
||||
fn void complex_div() @if(types::is_float(ElementType))
|
||||
|
||||
@@ -50,8 +50,8 @@ fn void test_mat4()
|
||||
-0.988936, -2.970838, -20.765262, 1.000000
|
||||
};
|
||||
|
||||
Matrix4 look_at = matrix::look_at(<double>)({4.0, 5.0, 20.0}, {1.0, 3.0, 0.0}, {0.0, 1.0, 0.0});
|
||||
Matrix4f look_at_f = matrix::look_at(<float>)({4.0, 5.0, 20.0}, {1.0, 3.0, 0.0}, {0.0, 1.0, 0.0});
|
||||
Matrix4 look_at = matrix::look_at{double}({4.0, 5.0, 20.0}, {1.0, 3.0, 0.0}, {0.0, 1.0, 0.0});
|
||||
Matrix4f look_at_f = matrix::look_at{float}({4.0, 5.0, 20.0}, {1.0, 3.0, 0.0}, {0.0, 1.0, 0.0});
|
||||
|
||||
assert(math::round_to_decimals((double[<16>])look_at.m, 4) == math::round_to_decimals((double[<16>])result.m, 4));
|
||||
assert(math::round_to_decimals((float[<16>])look_at_f.m, 4) == math::round_to_decimals((float[<16>])result_f.m, 4));
|
||||
|
||||
Reference in New Issue
Block a user