public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Tests for logicalNegation, getLogicalValue on int types added.
@ 2007-11-09 20:22 tthomas
  0 siblings, 0 replies; only message in thread
From: tthomas @ 2007-11-09 20:22 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  fd94985768aaab064cb3fdae15087ace1fa7b188 (commit)
      from  7f1af8e43becb1579889c0764a96e37e4efe52b1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit fd94985768aaab064cb3fdae15087ace1fa7b188
Author: Teresa Thomas <tthomas@redhat.com>
Date:   Fri Nov 9 15:21:16 2007 -0500

    Tests for logicalNegation, getLogicalValue on int types added.
    
    frysk-core/frysk/value/ChangeLog
    2007-11-09  Teresa Thomas  <tthomas@redhat.com>
    
    	* TestValue.java (testIntOps): Test for logicalNegation,
    	getLogicalValue added.
    	* IntegerUnit.java (logicalNegation): Simplify.

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/value/ChangeLog        |    6 ++++++
 frysk-core/frysk/value/IntegerUnit.java |    2 +-
 frysk-core/frysk/value/TestValue.java   |    5 +++++
 3 files changed, 12 insertions(+), 1 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/value/ChangeLog b/frysk-core/frysk/value/ChangeLog
index db39231..f89f379 100644
--- a/frysk-core/frysk/value/ChangeLog
+++ b/frysk-core/frysk/value/ChangeLog
@@ -1,5 +1,11 @@
 2007-11-09  Teresa Thomas  <tthomas@redhat.com>
 
+	* TestValue.java (testIntOps): Test for logicalNegation,
+	getLogicalValue added.
+	* IntegerUnit.java (logicalNegation): Simplify.
+
+2007-11-09  Teresa Thomas  <tthomas@redhat.com>
+
 	* FloatingPointUnit.java (lessThan): New.
 	(greaterThan): New.
 	(greaterThanOrEqualTo): New.
diff --git a/frysk-core/frysk/value/IntegerUnit.java b/frysk-core/frysk/value/IntegerUnit.java
index 655920e..7178356 100644
--- a/frysk-core/frysk/value/IntegerUnit.java
+++ b/frysk-core/frysk/value/IntegerUnit.java
@@ -136,7 +136,7 @@ public class IntegerUnit
     }  
     public Value logicalNegation(Value v1) {
 	return retType.createValue
-                       ((v1.asBigInteger().longValue() == 0 ? true : false) ? 1 : 0);
+                       (v1.asBigInteger().longValue() == 0 ? 1 : 0);
     }    
     public boolean getLogicalValue (Value v1) {
 	return ((v1.asBigInteger().longValue() == 0) ? false : true);
diff --git a/frysk-core/frysk/value/TestValue.java b/frysk-core/frysk/value/TestValue.java
index 10b087d..13f6142 100644
--- a/frysk-core/frysk/value/TestValue.java
+++ b/frysk-core/frysk/value/TestValue.java
@@ -102,6 +102,7 @@ public class TestValue
     {
 	Value v1 = intType.createValue(4);
 	Value v2 = shortType.createValue(9);
+	boolean bool = false;
 	// Give bogus word size values.
 	Value v3 = v1.getType().getALU(v2.getType(), 0).add(v1, v2);
 	assertEquals ("4 + 9", 4 + 9, v3.asLong());	
@@ -139,6 +140,10 @@ public class TestValue
 	assertEquals ("9 & 4", 1, v3.asLong());
 	v3 = v1.getType().getALU(v2.getType(), 0).logicalOr(v2, v1);
 	assertEquals ("9 | 4", 1, v3.asLong());	
+	v3 = v1.getType().getALU(v1.getType(), 0).logicalNegation(v1);
+	assertEquals ("!4", 0, v3.asLong());		
+	bool = v2.getType().getALU(v2.getType(), 0).getLogicalValue(v2);
+	assertEquals ("bool(9)", true, bool);		
 	v3 = v3.assign(v1);	
 	assertEquals ("v3 = 4", 4, v3.asLong());
 	v3 = v3.getType().getALU(v1.getType(), 0).plusEqual(v3, v1);


hooks/post-receive
--
frysk system monitor/debugger


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-11-09 20:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-09 20:22 [SCM] master: Tests for logicalNegation, getLogicalValue on int types added tthomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).