Back to index

lightning-sunbird  0.9+nobinonly
Static Public Member Functions | Static Private Member Functions
TestVersionComparator Class Reference

List of all members.

Static Public Member Functions

static void main (String[] args)

Static Private Member Functions

static void _assert (boolean expression)

Detailed Description

Definition at line 40 of file TestVersionComparator.java.


Member Function Documentation

static void TestVersionComparator._assert ( boolean  expression) [inline, static, private]

Definition at line 94 of file TestVersionComparator.java.

                                                  {
    if (!expression) {
      Throwable t = new Throwable();
      t.printStackTrace();
      System.exit(1);
    }
  }

Here is the caller graph for this function:

static void TestVersionComparator.main ( String[]  args) [inline, static]

Definition at line 42 of file TestVersionComparator.java.

                                         {
    String[] comparisons = {
        "0.9",
        "0.9.1",
        "1.0pre1",
        "1.0pre2",
        "1.0",
        "1.1pre",
        "1.1pre1a",
        "1.1pre1",
        "1.1pre10a",
        "1.1pre10",
        "1.1",
        "1.1.0.1",
        "1.1.1",
        "1.1.*",
        "1.*",
        "2.0",
        "2.1",
        "3.0.-1",
        "3.0"
    };

    String[] equality = {
        "1.1pre",
        "1.1pre0",
        "1.0+"
    };

    VersionComparator comp = new VersionComparator();

    // test comparisons in both directions
    for (int i = 0; i < comparisons.length - 1; i++) {
      int res = comp.compare(comparisons[i], comparisons[i + 1]);
      _assert(res < 0);

      res = comp.compare(comparisons[i + 1], comparisons[i]);
      _assert(res > 0);
    }

    // test equality in both directions
    for (int i = 0; i < equality.length - 1; i++) {
      int res = comp.compare(equality[i], equality[i + 1]);
      _assert(res == 0);

      res = comp.compare(equality[i + 1], equality[i]);
      _assert(res == 0);
    }

    System.out.println("-- passed");
  }

Here is the call graph for this function:


The documentation for this class was generated from the following file: