Skip to content

An automatic sort test framework in Cmake and xmake

Notifications You must be signed in to change notification settings

LiuYuan-SHU/TestSort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TestSort

An automatic sort test frame work in Cmake and xmake

Quick Start

Xmake is preferred, update in CMake might be latter than Xmake

  1. With Cmake:

    cmake -B build build
    cmake --build build
    ./build/bin/sort 
  2. With xmake:

    xmake
    xmake run

If you are using xmake, a debug version is built by default. If you want a fast version without debug symbols and so on, run:

xmake f -m fastest
xmake build
xmake run

In version 1.0.0, executable in fastest mode will cost 7ms while debug version costs 77 ms for 18 tests.

How to Use

  1. Implement your sorting algorithm, provide a callable object to algorithms in src/main.cpp. If you are not sure if your code fits the requirement, here is a small example:

    struct qsort_wrapper {
      inline __attribute__((always_inline)) void operator()(std::vector<int> &vec) {
        std::sort(vec.begin(), vec.end());
      }
    };

    Or you can inherit sort_algorithm_base in include/sort_algorithm_base.hpp and override operator() and provide an instance of the class, just like the example codes in src/main.cpp.

  2. Compile and run codes as Quick Start

About

An automatic sort test framework in Cmake and xmake

Resources

Stars

Watchers

Forks