Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
/nbproject/
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,28 @@ public BigInteger getOriginalValue() {
public void setOriginalValue(BigInteger originalValue) {
this.originalValue = originalValue;
}

@Override
public String toString() {
return "ModifiableBigInteger{" + "originalValue=" + originalValue + '}';
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof ModifiableBigInteger))
return false;

ModifiableBigInteger that = (ModifiableBigInteger) o;

return getValue() != null ? getValue().equals(that.getValue()) : that.getValue() == null;
}

@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (getValue() != null ? getValue().hashCode() : 0);
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,28 @@ public boolean validateAssertions() {
}
return true;
}

@Override
public String toString() {
return "ModifiableBoolean{" + "originalValue=" + originalValue + '}';
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof ModifiableBoolean))
return false;

ModifiableBoolean that = (ModifiableBoolean) o;

return getValue() != null ? getValue().equals(that.getValue()) : that.getValue() == null;
}

@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (getValue() != null ? getValue().hashCode() : 0);
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,22 @@ public String toString() {

}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof ModifiableByteArray))
return false;

ModifiableByteArray that = (ModifiableByteArray) o;

return Arrays.equals(getValue(), that.getValue());
}

@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + Arrays.hashCode(getValue());
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,28 @@ public Integer getOriginalValue() {
public void setOriginalValue(Integer originalValue) {
this.originalValue = originalValue;
}

@Override
public String toString() {
return "ModifiableInteger{" + "originalValue=" + originalValue + '}';
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof ModifiableInteger))
return false;

ModifiableInteger that = (ModifiableInteger) o;

return getValue() != null ? getValue().equals(that.getValue()) : that.getValue() == null;
}

@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (getValue() != null ? getValue().hashCode() : 0);
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,28 @@ public Integer getOriginalValue() {
public void setOriginalValue(Integer originalValue) {
throw new UnsupportedOperationException("Cannot set original Value of ModifiableLengthField");
}

@Override
public String toString() {
return "ModifiableLengthField{" + "ref=" + ref + "} " + super.toString();
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof ModifiableLengthField))
return false;

ModifiableLengthField that = (ModifiableLengthField) o;

return ref != null ? getValue().equals(that.getValue()) : that.getValue() == null;
}

@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (getValue() != null ? getValue().hashCode() : 0);
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,28 @@ public Long getOriginalValue() {
public void setOriginalValue(Long originalValue) {
this.originalValue = originalValue;
}

@Override
public String toString() {
return "ModifiableLong{" + "originalValue=" + originalValue + '}';
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof ModifiableLong))
return false;

ModifiableLong that = (ModifiableLong) o;

return getValue() != null ? getValue().equals(that.getValue()) : that.getValue() == null;
}

@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (getValue() != null ? getValue().hashCode() : 0);
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,28 @@ public Byte getOriginalValue() {
public void setOriginalValue(Byte originalValue) {
this.originalValue = originalValue;
}

@Override
public String toString() {
return "ModifiableByte{" + "originalValue=" + originalValue + '}';
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof ModifiableByte))
return false;

ModifiableByte that = (ModifiableByte) o;

return getValue() != null ? getValue().equals(that.getValue()) : that.getValue() == null;
}

@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (getValue() != null ? getValue().hashCode() : 0);
return result;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/*
* Copyright 2017 Robert Merget <robert.merget@rub.de>.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.rub.nds.modifiablevariable.biginteger;

import java.math.BigInteger;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;

/**
*
* @author Robert Merget <robert.merget@rub.de>
*/
public class ModifiableBigIntegerTest {

private ModifiableBigInteger integer1;

private ModifiableBigInteger integer2;

@Before
public void setUp() {
integer1 = new ModifiableBigInteger();
integer1.setOriginalValue(BigInteger.ONE);
integer2 = new ModifiableBigInteger();
integer2.setOriginalValue(BigInteger.TEN);
}

/**
* Test of createRandomModification method, of class ModifiableBigInteger.
*/
@Test
public void testCreateRandomModification() {
}

/**
* Test of getAssertEquals method, of class ModifiableBigInteger.
*/
@Test
public void testGetAssertEquals() {
}

/**
* Test of setAssertEquals method, of class ModifiableBigInteger.
*/
@Test
public void testSetAssertEquals() {
}

/**
* Test of isOriginalValueModified method, of class ModifiableBigInteger.
*/
@Test
public void testIsOriginalValueModified() {
}

/**
* Test of getByteArray method, of class ModifiableBigInteger.
*/
@Test
public void testGetByteArray_0args() {
}

/**
* Test of getByteArray method, of class ModifiableBigInteger.
*/
@Test
public void testGetByteArray_int() {
}

/**
* Test of validateAssertions method, of class ModifiableBigInteger.
*/
@Test
public void testValidateAssertions() {
}

/**
* Test of getOriginalValue method, of class ModifiableBigInteger.
*/
@Test
public void testGetOriginalValue() {
}

/**
* Test of setOriginalValue method, of class ModifiableBigInteger.
*/
@Test
public void testSetOriginalValue() {
}

/**
* Test of toString method, of class ModifiableBigInteger.
*/
@Test
public void testToString() {
}

/**
* Test of equals method, of class ModifiableBigInteger.
*/
@Test
public void testEquals() {
assertFalse(integer1.equals(integer2));
integer2.setOriginalValue(BigInteger.ONE);
assertTrue(integer1.equals(integer2));
}

/**
* Test of hashCode method, of class ModifiableBigInteger.
*/
@Test
public void testHashCode() {
}

}
Loading