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

Break up long testsets #247

Closed
wants to merge 16 commits into from
Closed

Break up long testsets #247

wants to merge 16 commits into from

Conversation

cpierard
Copy link

@cpierard cpierard commented Mar 7, 2017

Break chunks of code that are longer than 100 lines in the file libieeep1788_tests_elem.jl.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 91.284% when pulling 06cbf1d on cpierard:rama_trabajo into c7a230a on dpsanders:master.

@codecov-io
Copy link

codecov-io commented Mar 7, 2017

Codecov Report

Merging #247 into master will increase coverage by 0.78%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #247      +/-   ##
==========================================
+ Coverage   91.28%   92.06%   +0.78%     
==========================================
  Files          26       26              
  Lines        1044     1084      +40     
==========================================
+ Hits          953      998      +45     
+ Misses         91       86       -5
Impacted Files Coverage Δ
src/intervals/rounding.jl 71.79% <0%> (-4.68%) ⬇️
src/intervals/precision.jl 88.46% <0%> (-1.2%) ⬇️
src/display.jl 93.18% <0%> (-0.16%) ⬇️
src/intervals/functions.jl 95.74% <0%> (ø) ⬆️
src/root_finding/newton.jl 91.22% <0%> (ø) ⬆️
src/root_finding/bisect.jl 100% <0%> (ø) ⬆️
src/ValidatedNumerics.jl 100% <0%> (ø) ⬆️
src/intervals/arithmetic.jl 100% <0%> (+1.35%) ⬆️
src/multidim/intervalbox.jl 86.66% <0%> (+2.05%) ⬆️
src/decorations/intervals.jl 84.61% <0%> (+2.56%) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c7a230a...cee7623. Read the comment docs.

@dpsanders
Copy link
Member

Thanks! Did you do this by hand or in an automated way?

@cpierard
Copy link
Author

cpierard commented Mar 8, 2017

I did it by hand. I tried doing it in an automated way, but I failed.

@dpsanders
Copy link
Member

These files are automatically generated, so the next time they are regenerated all of your work will be lost. That's why this should be done in an automated way.

What did you try?

@cpierard
Copy link
Author

cpierard commented Mar 8, 2017

Didn't know that. This is what I did so far:

f = open("libieeep1788_tests_elem.jl")
code_lines = readlines(f)

#println(code_lines[70][1:5])
#println(length(code_lines))

A = Int[]

chunk_begin = 0
chunk_end = 0

for i in 1:length(code_lines)

  if length(code_lines[i]) <= 3

    nothing

  elseif code_lines[i][1:3] == "fac"

    chunk_begin = i
    #println(chunk_begin)

  elseif code_lines[i][1:3] == "end"

    chunk_end = i
    #println(chunk_end)

  end

  if chunk_end - chunk_begin > 100

    push!(A, chunk_begin)
    chunk_end = 0

  end

end

println(A)

This code looks for the big blocks of code bigger than 100. My idea was to break-up the blocks in smaller ones by inserting facts(... ) do and end between the big blocks in the array that contains all the lines of code.

Do you have any suggestions?

@dpsanders dpsanders changed the title Break up big suits of code Break up big test suites Mar 12, 2017
@dpsanders
Copy link
Member

That looks like a good start.
You can use the startswith function to look at the start of a line.

I suggest you just accumulate the lines in each facts block into an array, and then write them out in blocks of 100 in new facts blocks.

@dpsanders
Copy link
Member

(Of course, 100 should be a variable that can be changed.)

@coveralls
Copy link

coveralls commented Mar 15, 2017

Coverage Status

Coverage increased (+0.02%) to 91.309% when pulling 6aca91c on cpierard:rama_trabajo into c7a230a on dpsanders:master.

@dpsanders
Copy link
Member

This is looking nice!

I suggest making this into a function which takes in a file name and chunk size as arguments.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 91.333% when pulling 9419559 on cpierard:rama_trabajo into c7a230a on dpsanders:master.

@cpierard
Copy link
Author

Ok, I will wrap it in a function once is working well. What did you mean by expressions? Can you read an entire file as an expression (or an array of expressions)?

@dpsanders
Copy link
Member

I meant "regular expression" -- it's a way to specify a pattern to match and to capture the result of matching that pattern:

https://en.wikipedia.org/wiki/Regular_expression

https://en.wikibooks.org/wiki/Introducing_Julia/Strings_and_characters#Regular_expressions

@cpierard
Copy link
Author

thanks! It's just what I was looking for this morning. It will make the code look cleaner.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 91.333% when pulling 0afc242 on cpierard:rama_trabajo into c7a230a on dpsanders:master.

@lbenet
Copy link
Member

lbenet commented Mar 16, 2017

Would it be possible to get rid of a bunch of empty lines in test/ITF1788_tests/test_file.jl ?

@cpierard
Copy link
Author

cpierard commented Mar 18, 2017

@lbenet Yes, it was a problem with the delimiter in the instruction join(code_lines_new, "\n"). Now is writing the file without empty lines.

@coveralls
Copy link

coveralls commented Mar 18, 2017

Coverage Status

Coverage decreased (-1.01%) to 90.269% when pulling 871b973 on cpierard:rama_trabajo into c7a230a on dpsanders:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.01%) to 90.269% when pulling 871b973 on cpierard:rama_trabajo into c7a230a on dpsanders:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-1.01%) to 90.269% when pulling 871b973 on cpierard:rama_trabajo into c7a230a on dpsanders:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.01%) to 90.269% when pulling d87213b on cpierard:rama_trabajo into c7a230a on dpsanders:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-1.01%) to 90.269% when pulling d87213b on cpierard:rama_trabajo into c7a230a on dpsanders:master.

@cpierard
Copy link
Author

I think the function is finished . I was comparing the test_file.jl with the original file, and it seems that all the lines of code are in the test file. Maybe the name for the function is not the best...

@coveralls
Copy link

coveralls commented Mar 19, 2017

Coverage Status

Coverage decreased (-1.01%) to 90.269% when pulling 51af0f4 on cpierard:rama_trabajo into c7a230a on dpsanders:master.

@dpsanders dpsanders changed the title Break up big test suites Break up long testsets Mar 19, 2017
@dpsanders
Copy link
Member

Thanks, it's looking good!
So in the end you didn't use regular expressions?

Maybe a better name is something like split_testsets (for the function and the filename).

Could you write a test for this? I suggest using a simple test file like the one here: JuliaLang/julia#15346

The next step would be to make a new file that runs through each of the test files in the directory and splits them with a sensible name, maybe as they are being run.

I wonder if it would even be sensible to make this into a separate package, though that can be done later.

@cpierard
Copy link
Author

I didn't include my attempts to use regex because they were not working. So far I found the expression to match the title for each block:

match(r"\".*\"", code_lines[chunk_begin]).match

But returns "\"minimal_pos_test\"", and I have to get rid of the extras ".

I found two solutions:

title = parse(match(r"\".*\"", code_lines[chunk_begin]).match)

or

title = split(match(r"\".*\"", code_lines[chunk_begin]).match, "\"")[2].

Ok, I will start writing the test for this.

@coveralls
Copy link

coveralls commented Mar 21, 2017

Coverage Status

Coverage increased (+0.8%) to 92.066% when pulling cee7623 on cpierard:rama_trabajo into c7a230a on dpsanders:master.

@dpsanders
Copy link
Member

In the latest versions of Julia, the tests run much faster, so this is probably no longer necessary.

@dpsanders dpsanders closed this Mar 2, 2019
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.

5 participants