-
Notifications
You must be signed in to change notification settings - Fork 77
Issue2 tests fail on windows #26
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
Changes from all commits
f7cd67d
077abb7
5054060
a0128b9
f3e12da
faec599
9aa6598
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,7 @@ private void createFile(File target, int max) throws FileNotFoundException { | |
|
|
||
|
|
||
| public void testGetRecordIteratorStringBoolean() throws IOException { | ||
| File test = new File("/tmp/test.tmp"); | ||
| File test = File.createTempFile("test", null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, why not |
||
| int max = 1000000; | ||
| createFile(test,max); | ||
| RandomAccessFileSeekableLineReaderFactory factory = | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,28 +4,19 @@ | |
| import java.io.File; | ||
| import java.io.FileNotFoundException; | ||
| import java.io.FileReader; | ||
| import java.io.IOException; | ||
| import java.io.PrintWriter; | ||
| import java.util.Comparator; | ||
|
|
||
| import junit.framework.TestCase; | ||
|
|
||
| public class SortedCompositeIteratorTest extends TestCase { | ||
|
|
||
| public void testHasNext() throws FileNotFoundException { | ||
| public void testHasNext() throws FileNotFoundException, IOException { | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where these lines non-functional?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the only use of "long t", "long c" and "float f" were to output the "System.err". An estimated guess is that the original writer for some reason needed to calculate "134/210000" and put it into the code, then forgot about it. |
||
| long t = 210000; | ||
| long c = 134; | ||
| float f = (float)c / (float)t; | ||
| System.err.format("F(%f)\n",f); | ||
| File a = File.createTempFile("filea", null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| File b = File.createTempFile("fileb", null); | ||
|
|
||
| File a = new File("/tmp/a"); | ||
| File b = new File("/tmp/b"); | ||
| if(a.isFile()) { | ||
| a.delete(); | ||
| } | ||
| if(b.isFile()) { | ||
| b.delete(); | ||
| } | ||
| PrintWriter apw = new PrintWriter(a); | ||
| PrintWriter bpw = new PrintWriter(b); | ||
| apw.println("1"); | ||
|
|
@@ -38,6 +29,7 @@ public void testHasNext() throws FileNotFoundException { | |
| BufferedReader bbr = new BufferedReader(new FileReader(b)); | ||
| SortedCompositeIterator<String> sci = new SortedCompositeIterator<String>(new Comparator<String>() { | ||
|
|
||
| @Override | ||
| public int compare(String o1, String o2) { | ||
| return o1.compareTo(o2); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it make more sense to use
java.io.tmpdirenv. variable than relying on the current directory being suitable for tmp files?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the javadoc of File.createTempFile():
"Creates an empty file in the default temporary-file directory, using the given prefix and suffix to generate its name."
The default temporary-file dir should equal java.io.tmpdir which can be extracted using System.getProperty(). This could have been used, but then you would have construct a file using this string + file name. The current approach just gives fewer lines of code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough.