Skip to content

Commit

Permalink
Tests added.
Browse files Browse the repository at this point in the history
  • Loading branch information
joergen7 committed Dec 27, 2015
1 parent 46a8c16 commit a0de95a
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public abstract class BaseRepl {
public static final int CTL_TICKETSET = 8;

public static final String LABEL_VERSION = "2.0.2-SNAPSHOT";
public static final String LABEL_BUILD = "2015-11-06";
public static final String LABEL_BUILD = "2015-12-27";

private final CfSemanticModelVisitor state;
private final Map<UUID,DynamicNodeVisitor> runningMap;
Expand Down
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 );
}
}

0 comments on commit a0de95a

Please sign in to comment.