godot-cpp icon indicating copy to clipboard operation
godot-cpp copied to clipboard

Added test case for returning doubles

Open BastiaanOlij opened this issue 4 years ago • 0 comments

Added a test case for an issue I'm looking into, just raising a draft PR to show the code, hopefully will change this into a fix once I know :)

The method I'm testing is really simple:

double Example::return_double(double p_a, double p_b) {
	return p_a + p_b;
}

Added two test cases:

prints("return 1 + 2 = ", $Example.return_double(1, 2))
prints("return 1.5 + 2.0 = ", $Example.return_double(1.5, 2.0))

The output currently is:

return 1 + 2 =  0
return 1.5 + 2.0 =  3.5

Originally I thought something was going wrong in returning the value as we were getting values in a and b but on close inspection those values are rubbish. The problem seems to be related to converting integer values to doubles..

BastiaanOlij avatar Oct 17 '21 02:10 BastiaanOlij