]> err.no Git - libchamplain/commitdiff
Add the VERSION macros
authorEmmanuel Rodriguez <emmanuel.rodriguez@gmail.com>
Sat, 16 May 2009 20:08:20 +0000 (22:08 +0200)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Mon, 18 May 2009 20:12:21 +0000 (16:12 -0400)
  - MAJOR_VERSION, MINOR_VERSION and MICRO_VERSION
- CHECK_VERSION
- GET_VERSION_INFO

bindings/perl/Champlain/t/Champlain.t
bindings/perl/Champlain/xs/Champlain.xs

index c84c16a0288889875520bab35f7d15ab5181c708..23da614917740921b0d2fa8ff416dc19017163f8 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Clutter::TestHelper tests => 5;
+use Clutter::TestHelper tests => 11;
 
 use Champlain ':coords';
 
@@ -18,6 +18,21 @@ sub tests {
 
 sub test_version {
        ok($Champlain::VERSION, "Library loaded");
+
+       ok(defined Champlain::MAJOR_VERSION, "MAJOR_VERSION exists");
+       ok(defined Champlain::MINOR_VERSION, "MINOR_VERSION exists");
+       ok(defined Champlain::MICRO_VERSION, "MICRO_VERSION exists");
+
+       ok (Champlain->CHECK_VERSION(0,0,0), "CHECK_VERSION pass");
+       ok (!Champlain->CHECK_VERSION(50,0,0), "CHECK_VERSION fail");
+
+       my @version = Champlain->GET_VERSION_INFO;
+       my @expected = (
+               Champlain::MAJOR_VERSION,
+               Champlain::MINOR_VERSION,
+               Champlain::MICRO_VERSION,
+       );
+       is_deeply(\@version, \@expected, "GET_VERSION_INFO");
 }
 
 
index aeb323a17572d905b41aa30842f3a452cb6eb375..b6779073f6d3bad6aaeb8e187dbc5de0b42410e3 100644 (file)
@@ -8,3 +8,48 @@ BOOT:
 #include "register.xsh"
 #include "boot.xsh"
 
+
+guint 
+MAJOR_VERSION ()
+       CODE:
+               RETVAL = CHAMPLAIN_MAJOR_VERSION;
+       
+       OUTPUT:
+               RETVAL
+
+
+guint 
+MINOR_VERSION ()
+       CODE:
+               RETVAL = CHAMPLAIN_MINOR_VERSION;
+       
+       OUTPUT:
+               RETVAL
+
+
+guint 
+MICRO_VERSION ()
+       CODE:
+               RETVAL = CHAMPLAIN_MICRO_VERSION;
+       
+       OUTPUT:
+               RETVAL
+
+
+void
+GET_VERSION_INFO (class)
+       PPCODE:
+               EXTEND (SP, 3);
+               PUSHs (sv_2mortal (newSViv (CHAMPLAIN_MAJOR_VERSION)));
+               PUSHs (sv_2mortal (newSViv (CHAMPLAIN_MINOR_VERSION)));
+               PUSHs (sv_2mortal (newSViv (CHAMPLAIN_MICRO_VERSION)));
+               PERL_UNUSED_VAR (ax);
+
+
+gboolean
+CHECK_VERSION (class, int major, int minor, int micro)
+       CODE:
+               RETVAL = CHAMPLAIN_CHECK_VERSION (major, minor, micro);
+
+       OUTPUT:
+               RETVAL