/** * Generic test class for implementing * functions for benchmarking sorting functions * _ _ _ _ * __ ___ __(_) |_| |_ ___ _ __ | |__ _ _ * \ \ /\ / / '__| | __| __/ _ \ '_ \ | '_ \| | | | * \ V V /| | | | |_| || __/ | | | | |_) | |_| | * \_/\_/ |_| |_|\__|\__\___|_| |_| |_.__/ \__, | * |___/ * ____ __ __ _ * / ___|_ _____ _ __ \ \ / /__ __ _ ___| | * \___ \ \ / / _ \ '_ \ \ \ / / _ \ / _` |/ _ \ | * ___) \ V / __/ | | | \ V / (_) | (_| | __/ | * |____/ \_/ \___|_| |_| \_/ \___/ \__, |\___|_| * |___/ * Licensed under the GPLv2 License, Version 2.0 (the "License"); * Copyright (c) Sven Vogel */ #include "arrays.h" #include "bench.h" #include "sort.h" #include #include const int LEN = 10000; const Sort TESTS[] = { {"bubble", bubble}, {"gnome", gnome}, {"selection", selection}, {"quick", quick}, {"merge", merge}, {"shell", shell}, {"insertion", insertion}, {"radix", radix}, }; int main() { int *arr = (int *)malloc(sizeof(int) * LEN); populate(arr, LEN); srand(time(NULL)); benchmark(TESTS, sizeof(TESTS) / sizeof(Sort), arr, LEN); free(arr); return 0; }