From a5d61f6da0c064798a1cca082d54794571bded74 Mon Sep 17 00:00:00 2001 From: Simon Heuser <39399016+shsr04@users.noreply.github.com> Date: Tue, 15 Oct 2019 11:43:28 +0200 Subject: [PATCH] math.complex: make fields public --- vlib/math/complex/complex.v | 1 + vlib/math/complex/complex_test.v | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/vlib/math/complex/complex.v b/vlib/math/complex/complex.v index 8f38a23146..0bed7dfc56 100644 --- a/vlib/math/complex/complex.v +++ b/vlib/math/complex/complex.v @@ -7,6 +7,7 @@ module complex import math struct Complex { +pub: re f64 im f64 } diff --git a/vlib/math/complex/complex_test.v b/vlib/math/complex/complex_test.v index be445203da..1cc26abb45 100644 --- a/vlib/math/complex/complex_test.v +++ b/vlib/math/complex/complex_test.v @@ -781,3 +781,9 @@ fn test_complex_acsch() { // Some issue with precision comparison in f64 using == operator hence serializing to string assert result.str().eq(c2.str()) } + +fn test_complex_re_im() { + c := cmplx.complex(2.1, 9.05) + assert c.re == 2.1 + assert c.im == 9.05 +}