Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests for lib_string_format #108

Open
wants to merge 31 commits into
base: develop
Choose a base branch
from
Open

tests for lib_string_format #108

wants to merge 31 commits into from

Conversation

BalazsNyiro
Copy link

I collected string formatting tests to increase the cover and find differences between native Lua and LuErl

@rvirding
Copy link
Owner

Can you give me a hint in what way the string formatting differs? Is it something to do with 5.3 and integers or is it a deeper issue?

@BalazsNyiro
Copy link
Author

The differences between LuErl and native Lua 5.3 are not too big. They are typically the number of zeros, or formatting differences.

for example in Lua:

string.format("%e, %E", math.pi, math.pi)
3.141593e+00, 3.141593E+00

In LuErl %e and %E give back the same output:
6> luerl:eval("return string.format("%e, %E", math.pi, math.pi)").
{ok,[<<"3.141593e+0, 3.141593e+0">>]}

Here are only one zero and small E in both case.

Or in other case:

string.format("%g, %g", math.pi, 10^9)
3.14159, 1e+09

Lua:

string.format("%g, %g", math.pi, 10^9)
3.14159, 1e+09

LuErl:
7> luerl:eval("return string.format("%g, %g", math.pi, 10^9)").
{ok,[<<"3.14159, 1.00000e+9">>]}

We discussed these differences with Ferenc Borocki. LuErl's results are correct if you see only the value of the results, so we think first we should collect all the differences and when we reached the 100% coverage, we can fix/debug the differences if you tell that it is important.

I think you should declare which differences should be repaired and which one's are not important.

My personal opinion is that sooner or later LuErl will be used in wider area so I think the similar behaviour would be important.

I am on holiday now but from middle of July I would be happy to reach the 100% coverage and to find the cause of all differences.

@rvirding
Copy link
Owner

OK, I will include and start attacking the problem. One reason for the difference iirc is that Luerl basically uses the builtin erlang formating and accepts what it outputs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants