Ticket #1965: tt1965.patch

File tt1965.patch, 1.2 KB (added by doughera, 11 years ago)
  • src/dynpmc/rational.pmc

    diff --git a/src/dynpmc/rational.pmc b/src/dynpmc/rational.pmc
    index 7db3090..a051768 100644
    a b  
    397397*/ 
    398398    VTABLE INTVAL get_bool() { 
    399399      #ifdef PARROT_HAS_GMP 
    400         if (mpq_cmp_si(RT(SELF), 0, 0)) 
     400        if (mpq_cmp_si(RT(SELF), 0, 1) == 0) 
    401401            return 0; 
    402402        else 
    403403            return 1; 
  • t/dynpmc/rational.t

    diff --git a/t/dynpmc/rational.t b/t/dynpmc/rational.t
    index 009120e..281ebce 100644
    a b  
    2525    $S0 = config_hash['gmp'] 
    2626 
    2727    unless $S0 goto no_gmp 
    28     plan(78) 
     28    plan(79) 
    2929    loadlib $P1, 'rational' 
    3030    test_init() 
    3131    test_destroy() 
     
    559559 
    560560.sub test_init 
    561561    new $P1, 'Rational' 
    562     ok($P1,'initialization') 
     562    is($P1, 0, 'initialization') 
    563563.end 
    564564 
    565565.sub test_destroy 
     
    669669    new $P0, 'Rational' 
    670670    $P0 = "0" 
    671671    $I0 = isfalse $P0 
    672  
    673     todo($I0, "0 value of rational does not evaluate correctly") 
     672    ok($I0, '0 should be false') 
     673    $P0 = "3/4" 
     674    $I0 = istrue $P0 
     675    ok($I0, '3/4 should be true') 
    674676.end 
    675677 
    676678# Local Variables: