From abe57dce7f05b574d08b1bcdc0ae386ed67e0348 Mon Sep 17 00:00:00 2001 From: Victor Goff Date: Wed, 20 Jan 2010 04:36:54 -0600 Subject: [PATCH] Devised a way to run by default all test cases except case #3, and updated DESCRIPTION to reflect that. --- DESCRIPTION | 24 +++++++++++++++++------- test_solution_acceptance.rb | 4 ++-- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ff35f55..033b7e3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -12,17 +12,27 @@ following test cases. The code in the test cases is sufficient to define the methods you must implement. This is an NP complete problem, and as such I have only provided very small -datasets in the test cases. Test case #3 takes the longest to solve and -you may find it easier to comment it out early in your development phase. -On a MBP Pro with a 2.4 GHz dual core processor and 4GB RAM, it took -just over 3 minutes to solve. The other three test cases took only a -couple of seconds. +datasets in the test cases. Test case #3 takes the longest to solve (See +**Notes below about how to run the Test Case #3) and you may find it easier +to comment it out early in your development phase. On a MBP Pro with a 2.4 +GHz dual core processor and 4GB RAM, it took just over 3 minutes to solve. +The other three test cases took only a couple of seconds. Note that test cases 2 and 4 define specific distributions against which you can verify. Test cases 1 and 3 have more than one acceptable distribution and as such I have not provided a specific distribution to test against. Note also that there is a well known algorithm that provides a much -faster though suboptimaly solution. It will pass all tests except for test +faster though not optimal solution. It will pass all tests except for test case #3. If you are only able to determine this particular solution, please -still consider submitting your solution for consideration. \ No newline at end of file +still consider submitting your solution for consideration. + +** Notes: +To accommodate the fact that Test Case #3 takes a long time to run, you +can run the test normally, and TC#3 will not run. When you want the TC#3 +to run, then you can run the following: + + ruby test_solution_acceptance.rb full + +The word "full" will signal it to run all the test cases. + diff --git a/test_solution_acceptance.rb b/test_solution_acceptance.rb index fc1adbf..adc8b84 100644 --- a/test_solution_acceptance.rb +++ b/test_solution_acceptance.rb @@ -50,7 +50,7 @@ def test_basic3 # [3.0, 0.73], # [2.3, 1.09, 0.23], # [1.75, 1.5, 0.27, 0.11] - end + end if ARGV[0] == "full" # only use this TC if 'full' is added as an argument. def test_basic4 jobs = [5,5,4,4,3,3,3] @@ -109,4 +109,4 @@ def distributions_are_equivalent?(dist1, dist2) def arrays_have_same_elements?(arr1, arr2) arr1.size == arr2.size && (arr1 - arr2).empty? end -end \ No newline at end of file +end