spek

Acoustic spectrum analyser https://github.com/alexkay/spek spek.cc
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

test-utils.cc (1110B)


      1 #include "spek-utils.h"
      2 
      3 #include "test.h"
      4 
      5 static void test_vercmp()
      6 {
      7     test<int>("1.2.3 == 1.2.3", 0, spek_vercmp("1.2.3", "1.2.3"));
      8     test("1.2.3 > 1.2.2", 1, spek_vercmp("1.2.3", "1.2.2"));
      9     test("1.2.2 < 1.2.3", -1, spek_vercmp("1.2.2", "1.2.3"));
     10     test("1.2.3 > 1", 1, spek_vercmp("1.2.3", "1"));
     11     test("1.2.3 > 1.", 1, spek_vercmp("1.2.3", "1."));
     12     test("1.2.3 > 1.2", 1, spek_vercmp("1.2.3", "1.2"));
     13     test("1.2.3 > 1.2.", 1, spek_vercmp("1.2.3", "1.2."));
     14     test("1.15.3 > 1.2", 1, spek_vercmp("1.15.3", "1.2"));
     15     test("2 > 1.2.2", 1, spek_vercmp("2", "1.2.2"));
     16     test("1.2.3 > ''", 1, spek_vercmp("1.2.3", ""));
     17     test("'' == ''", 0, spek_vercmp("", ""));
     18     test("123 == 123", 0, spek_vercmp("123", "123"));
     19     test("0.2.3 < 1", -1, spek_vercmp("0.2.3", "1"));
     20     test("0.9.8 < 0.10.1", -1, spek_vercmp("0.9.8", "0.10.1"));
     21     test("1.200 < 2.20", -1, spek_vercmp("1.200", "2.20"));
     22     test("1.0.0 < 2.0.0", -1, spek_vercmp("1.0.0", "2.0.0"));
     23     test("1.0.0 < 1.0.1", -1, spek_vercmp("1.0.0", "1.0.1"));
     24 }
     25 
     26 void test_utils()
     27 {
     28     run("vercmp", test_vercmp);
     29 }