Beispiel #1
0
int main(int argc, char *argv[]){
  if (argc < 2) die("USAGE: ex18 2 3 4 1 6");

  int count = argc - 1;
  int i = 0;
  char **inputs = argv + 1;
  
  int *numbers = malloc(count * sizeof(int));
  if(!numbers) die("Memory Error");
  
  for(i=0; i<count; i++){
    numbers[i] = atoi(inputs[i]);
  } 

  testSorting(numbers, count, sortedOrder);
  testSorting(numbers, count, reversedOrder);
  testSorting(numbers, count, strageOrder);

  return 0;
}
Beispiel #2
0
void testDiffusion()
{
	testSorting();
	testFastMatrixElim();
	testSetDiffusionAndTransport();
	testCylDiffn();
	testTaperingCylDiffn();
	testSmallCellDiffn();
	testCellDiffn();
	testCylDiffnWithStoich();
	testCalcJunction();
}
TEST(ExternalSortTest, keepsDuplicate) {
  testSorting({1, 1, 3, 3}, 1<<20); //already sorted
  testSorting({10, 8, 10, 8, 7}, 1<<20); //unsorted
}
TEST(ExternalSortTest, sortsValues) {
  testSorting({1, 2, 3, 12, 33}, 1<<20); //already sorted
  testSorting({10, 8, 23, 12, 43}, 1<<20); //unsorted
}
TEST(ExternalSortTest, handlesOneValue) {
  testSorting({42}, 1<<20); //only one elements
}
TEST(ExternalSortTest, handlesEmptyInput) {
  testSorting({}, 1<<20); //no values at all
}