Skip to content

Commit

Permalink
tests for AsyncSortingCollection
Browse files Browse the repository at this point in the history
  • Loading branch information
SilinPavel committed Jun 28, 2017
1 parent bf2a78d commit 21eb42c
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* The MIT License
*
* Copyright (c) 2009 The Broad Institute
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package htsjdk.samtools.util;

import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;

public class AsyncWriteSortingCollectionTest extends SortingCollectionTest {

@BeforeClass void setupClass() {System.setProperty("samjdk.sort_col_threads", "2");}

@BeforeMethod void setup() { resetTmpDir(); }
@AfterMethod void tearDown() { resetTmpDir(); }

@DataProvider(name = "test1")
public Object[][] createTestData() {
return new Object[][] {
{"empty", 0, 100},
{"singleton", 1, 100},

// maxRecordInRam for AsyncWriteSortingCollection is equals to 300 / (sort_col_threads + 1) = 100
{"less than threshold", 100, 300},
{"threshold minus 1", 99, 300},
{"greater than threshold", 550, 300},
{"threshold multiple", 600, 300},
{"threshold multiple plus one", 101, 300},
{"exactly threshold", 100, 300},
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
import htsjdk.HtsjdkTest;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

Expand All @@ -47,7 +45,7 @@ public class SortingCollectionTest extends HtsjdkTest {
protected File tmpDir() {
return new File(System.getProperty("java.io.tmpdir") + "/" + System.getProperty("user.name"), getClass().getSimpleName());
}

@BeforeMethod void setup() { resetTmpDir(); }
@AfterMethod void tearDown() { resetTmpDir(); }

Expand Down

0 comments on commit 21eb42c

Please sign in to comment.