about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--ext/raindrops/raindrops.c3
-rw-r--r--test/test_raindrops.rb6
2 files changed, 9 insertions, 0 deletions
diff --git a/ext/raindrops/raindrops.c b/ext/raindrops/raindrops.c
index 599f39d..766ee02 100644
--- a/ext/raindrops/raindrops.c
+++ b/ext/raindrops/raindrops.c
@@ -203,6 +203,9 @@ void Init_raindrops_ext(void)
 #endif
         rb_define_const(cRaindrops, "SIZE", SIZET2NUM(raindrop_size));
 
+        /* the maximum value a raindrop counter can hold */
+        rb_define_const(cRaindrops, "MAX", ULONG2NUM((unsigned long)-1));
+
         rb_define_alloc_func(cRaindrops, alloc);
 
         rb_define_method(cRaindrops, "initialize", init, 1);
diff --git a/test/test_raindrops.rb b/test/test_raindrops.rb
index aab1f14..6686796 100644
--- a/test/test_raindrops.rb
+++ b/test/test_raindrops.rb
@@ -4,6 +4,12 @@ require 'raindrops'
 
 class TestRaindrops < Test::Unit::TestCase
 
+  def test_raindrop_counter_max
+    assert_kind_of Integer, Raindrops::MAX
+    assert Raindrops::MAX > 0
+    printf "Raindrops::MAX = 0x%x\n", Raindrops::MAX
+  end
+
   def test_raindrop_size
     assert_kind_of Integer, Raindrops::SIZE
     assert Raindrops::SIZE > 0