mirror of
				https://github.com/Z3Prover/z3
				synced 2025-10-31 11:42:28 +00:00 
			
		
		
		
	Java API: bugfixes
Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
		
							parent
							
								
									1ed4e7c480
								
							
						
					
					
						commit
						bbfd9dd19f
					
				
					 3 changed files with 14 additions and 14 deletions
				
			
		|  | @ -882,10 +882,10 @@ class JavaExample | ||||||
|         Expr inum = rn.Numerator(); |         Expr inum = rn.Numerator(); | ||||||
|         Expr iden = rn.Denominator(); |         Expr iden = rn.Denominator(); | ||||||
|         System.out.println("Numerator: " + inum + " Denominator: " + iden); |         System.out.println("Numerator: " + inum + " Denominator: " + iden); | ||||||
|         if (inum.toString() != "42" || iden.toString() != "43") |         if (!inum.toString().equals("42") || !iden.toString().equals("43")) | ||||||
|             throw new TestFailedException(); |             throw new TestFailedException(); | ||||||
| 
 | 
 | ||||||
|         if (rn.ToDecimalString(3) != "0.976?") |         if (!rn.ToDecimalString(3).toString().equals("0.976?")) | ||||||
|             throw new TestFailedException(); |             throw new TestFailedException(); | ||||||
| 
 | 
 | ||||||
|         BigIntCheck(ctx, ctx.MkReal("-1231231232/234234333")); |         BigIntCheck(ctx, ctx.MkReal("-1231231232/234234333")); | ||||||
|  | @ -895,23 +895,23 @@ class JavaExample | ||||||
| 
 | 
 | ||||||
|         String bn = "1234567890987654321"; |         String bn = "1234567890987654321"; | ||||||
| 
 | 
 | ||||||
|         if (ctx.MkInt(bn).BigInteger().toString() != bn) |         if (!ctx.MkInt(bn).BigInteger().toString().equals(bn)) | ||||||
|             throw new TestFailedException(); |             throw new TestFailedException(); | ||||||
| 
 | 
 | ||||||
|         if (ctx.MkBV(bn, 128).BigInteger().toString() != bn) |         if (!ctx.MkBV(bn, 128).BigInteger().toString().equals(bn)) | ||||||
|             throw new TestFailedException(); |             throw new TestFailedException(); | ||||||
| 
 | 
 | ||||||
|         if (ctx.MkBV(bn, 32).BigInteger().toString() == bn) |         if (ctx.MkBV(bn, 32).BigInteger().toString().equals(bn)) | ||||||
|             throw new TestFailedException(); |             throw new TestFailedException(); | ||||||
| 
 | 
 | ||||||
|         // Error handling test. |         // Error handling test. | ||||||
|         try |         try | ||||||
|         { |         { | ||||||
|             Expr plus_ri = ctx.MkAdd(new ArithExpr[] { ctx.MkInt(1), |             IntExpr i = ctx.MkInt("0.5"); | ||||||
|                     ctx.MkReal(2) }); |  | ||||||
|             throw new TestFailedException(); // unreachable |             throw new TestFailedException(); // unreachable | ||||||
|         } catch (Z3Exception e) |         } catch (Z3Exception e) | ||||||
|         { |         { | ||||||
|  |             System.out.println("GOT: " + e.getMessage()); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -2211,9 +2211,13 @@ class JavaExample | ||||||
|         } catch (TestFailedException ex) |         } catch (TestFailedException ex) | ||||||
|         { |         { | ||||||
|             System.out.println("TEST CASE FAILED: " + ex.getMessage()); |             System.out.println("TEST CASE FAILED: " + ex.getMessage()); | ||||||
|  |             System.out.println("Stack trace: "); | ||||||
|  |             ex.printStackTrace(System.out);      | ||||||
|         } catch (Exception ex) |         } catch (Exception ex) | ||||||
|         { |         { | ||||||
|             System.out.println("Unknown Exception: " + ex.getMessage()); |             System.out.println("Unknown Exception: " + ex.getMessage()); | ||||||
|  |             System.out.println("Stack trace: "); | ||||||
|  |             ex.printStackTrace(System.out); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -86,7 +86,6 @@ public class Context extends IDisposable | ||||||
| 	 **/ | 	 **/ | ||||||
| 	public BoolSort BoolSort() throws Z3Exception | 	public BoolSort BoolSort() throws Z3Exception | ||||||
| 	{ | 	{ | ||||||
| 
 |  | ||||||
| 		if (m_boolSort == null) | 		if (m_boolSort == null) | ||||||
| 			m_boolSort = new BoolSort(this); | 			m_boolSort = new BoolSort(this); | ||||||
| 		return m_boolSort; | 		return m_boolSort; | ||||||
|  | @ -97,7 +96,6 @@ public class Context extends IDisposable | ||||||
| 	 **/ | 	 **/ | ||||||
| 	public IntSort IntSort() throws Z3Exception | 	public IntSort IntSort() throws Z3Exception | ||||||
| 	{ | 	{ | ||||||
| 
 |  | ||||||
| 		if (m_intSort == null) | 		if (m_intSort == null) | ||||||
| 			m_intSort = new IntSort(this); | 			m_intSort = new IntSort(this); | ||||||
| 		return m_intSort; | 		return m_intSort; | ||||||
|  | @ -106,8 +104,10 @@ public class Context extends IDisposable | ||||||
| 	/** | 	/** | ||||||
| 	 * Retrieves the Real sort of the context. | 	 * Retrieves the Real sort of the context. | ||||||
| 	 **/ | 	 **/ | ||||||
| 	public RealSort RealSort() | 	public RealSort RealSort() throws Z3Exception  | ||||||
| 	{ | 	{ | ||||||
|  | 	    if (m_realSort== null) | ||||||
|  | 	        m_realSort = new RealSort(this); | ||||||
| 		return m_realSort; | 		return m_realSort; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1786,8 +1786,6 @@ public class Expr extends AST | ||||||
| 				return new RatNum(ctx, obj); | 				return new RatNum(ctx, obj); | ||||||
| 			case Z3_BV_SORT: | 			case Z3_BV_SORT: | ||||||
| 				return new BitVecNum(ctx, obj); | 				return new BitVecNum(ctx, obj); | ||||||
| 			case Z3_UNKNOWN_SORT: |  | ||||||
| 				throw new Z3Exception("Unknown Sort"); |  | ||||||
| 			default: ; | 			default: ; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | @ -1806,8 +1804,6 @@ public class Expr extends AST | ||||||
| 			return new ArrayExpr(ctx, obj); | 			return new ArrayExpr(ctx, obj); | ||||||
| 		case Z3_DATATYPE_SORT: | 		case Z3_DATATYPE_SORT: | ||||||
| 			return new DatatypeExpr(ctx, obj); | 			return new DatatypeExpr(ctx, obj); | ||||||
| 		case Z3_UNKNOWN_SORT: |  | ||||||
| 			throw new Z3Exception("Unknown Sort"); |  | ||||||
| 		default: ; | 		default: ; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue