-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...iform-core/src/test/java/de/huberlin/wbi/cuneiform/core/semanticmodel/HashHelperTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package de.huberlin.wbi.cuneiform.core.semanticmodel; | ||
|
||
import org.junit.Test; | ||
import static org.junit.Assert.assertNotEquals; | ||
|
||
import java.util.UUID; | ||
|
||
|
||
public class HashHelperTest { | ||
|
||
|
||
@SuppressWarnings("static-method") | ||
@Test | ||
public void hashPreservesDifferencesBetweenStrings() { | ||
|
||
String a, b; | ||
long h1, h2; | ||
|
||
a = "bla"; | ||
b = "blub"; | ||
|
||
h1 = HashHelper.add( 0L, a ); | ||
h2 = HashHelper.add( 0L, b ); | ||
|
||
assertNotEquals( h1, h2 ); | ||
} | ||
|
||
@SuppressWarnings("static-method") | ||
@Test | ||
public void hashPreservesDifferencesBetweenTickets() { | ||
|
||
Ticket a, b; | ||
long h1, h2; | ||
UUID uuid; | ||
ForeignLambdaExpr lambda1, lambda2; | ||
Block bindingBlock; | ||
Prototype prototype; | ||
String lang; | ||
String body1, body2; | ||
|
||
uuid = UUID.randomUUID(); | ||
bindingBlock = new Block(); | ||
|
||
prototype = new Prototype(); | ||
lang = ForeignLambdaExpr.LANGID_BASH; | ||
body1 = "bla"; | ||
body2 = "blub"; | ||
|
||
lambda1 = new ForeignLambdaExpr( prototype, lang, body1 ); | ||
lambda2 = new ForeignLambdaExpr( prototype, lang, body2 ); | ||
|
||
a = new Ticket( lambda1, bindingBlock, uuid ); | ||
b = new Ticket( lambda2, bindingBlock, uuid ); | ||
|
||
h1 = HashHelper.add( 0L, a ); | ||
h2 = HashHelper.add( 0L, b ); | ||
|
||
assertNotEquals( h1, h2 ); | ||
} | ||
} |