version

Log

Files

Refs

README

LICENSE

main.c (1977B)

     1 #! /usr/bin/env sheepy
     2 /* or direct path to sheepy: #! /usr/local/bin/sheepy */
     3 
     4 /* Libsheepy documentation: http://spartatek.se/libsheepy/ */
     5 #include "libsheepyObject.h"
     6 #include "version.h"
     7 #include "shpPackages/short/short.h"
     8 
     9 int argc; char **argv;
    10 
    11 /* enable/disable logging */
    12 /* #undef pLog */
    13 /* #define pLog(...) */
    14 
    15 int main(int ARGC,  char** ARGV) {
    16 
    17   argc = ARGC; argv = ARGV;
    18 
    19   initLibsheepy(ARGV[0]);
    20   setLogMode(LOG_FUNC);
    21   setLogSymbols(LOG_UTF8);
    22 
    23   createVersion(ver);
    24   goto ltgt;
    25 
    26 prerel:
    27   /* lv(parseO(&ver, "1.1.1.x-pre")); */
    28   /* ver.f->log(&ver); */
    29   /* XSUCCESS */
    30 equal:
    31   lv(parseO(&ver, "ver-1.1.2.1.xxv-23+qwe"));
    32   logO(&ver);
    33   lv(satisfiesO(&ver, "1.1.2.1.x-x+x"))
    34   XSUCCESS
    35 
    36 ltgt:
    37   lv(parseO(&ver, "ver-1.2.3-beta.3"));
    38   logO(&ver);
    39   var vs = toJsonStrO(&ver);
    40   lv(vs);
    41   free(vs);
    42   lv(satisfiesO(&ver, "~1.2.3-beta.2"))
    43   XSUCCESS
    44 
    45 inc:
    46   lv(parseO(&ver, "1"));
    47   var S = toStringO(&ver);
    48   lv(S);
    49   free(S);
    50   incO(&ver, releaseVer);
    51   S = toStringO(&ver);
    52   lv(S);
    53   free(S);
    54   incO(&ver, 4);
    55   S = toStringO(&ver);
    56   lv(S);
    57   incO(&ver, patchVer);
    58   S = toStringO(&ver);
    59   lv(S);
    60   free(S);
    61   incO(&ver, minorVer);
    62   S = toStringO(&ver);
    63   lv(S);
    64   free(S);
    65   incO(&ver, majorVer);
    66   S = toStringO(&ver);
    67   lv(S);
    68   free(S);
    69 
    70 build:
    71   lv(parseO(&ver, "0.2+pre"));
    72   lv(&ver.build);
    73   logNFree(toStringO(&ver));
    74 
    75   createVersion(vr);
    76   lv(parseO(&vr, "0.2+pre-1"));
    77   lv(eqO(&ver, &vr));
    78 
    79 cmp:
    80   lv(cmpO(&ver, &vr));
    81   vr.major--;
    82   lv(cmpO(&ver, &vr));
    83   vr.major++;
    84   vr.minor++;
    85   lv(cmpO(&ver, &vr));
    86 
    87 json:;
    88   var j = toJsonO(&vr);
    89   lv(j);
    90   terminateG(j);
    91   var s = toJsonStrO(&vr);
    92   lv(s);
    93   fromJsonStrO(&ver, s);
    94   free(s);
    95 
    96   logNFree(toStringO(&ver));
    97 
    98 sorting:;
    99   var arr = createSA("1.1+b.1", "1.1+b", "1.1", "2.0", "1.0", "1.1.1", "1.1-pr", "1.1-pr.1");
   100 
   101   var sorted = vsortO(&ver, arr);
   102 
   103   lv(arr);
   104   lv(sorted);
   105 
   106   terminateManyG(arr,sorted);
   107 
   108   freeO(&ver);
   109   freeO(&vr);
   110 }
   111 // vim: set expandtab ts=2 sw=2: