move tests to community

This commit is contained in:
anna
2013-02-12 10:22:22 +01:00
parent 0d0972aa8b
commit e6657a722f
33 changed files with 513 additions and 0 deletions
@@ -0,0 +1,15 @@
abstract class SuperTest {
public abstract boolean equals(Object object);
}
class Test extends SuperTest {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
return true;
}
public int hashCode() {
return 0;
}
}
@@ -0,0 +1,28 @@
import java.util.Arrays;
class Test {
Object[] myOs;
int[][] myIIs;
int[] myIs;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final Test test = (Test) o;
// Compare nested arrays - values of myIIs here
if (!Arrays.equals(myIs, test.myIs)) return false;
// Probably incorrect - comparing Object[] arrays with Arrays.equals
if (!Arrays.equals(myOs, test.myOs)) return false;
return true;
}
public int hashCode() {
int result = myOs != null ? myOs.hashCode() : 0;
result = 31 * result + (myIIs != null ? myIIs.hashCode() : 0);
result = 31 * result + (myIs != null ? myIs.hashCode() : 0);
return result;
}
}
@@ -0,0 +1,28 @@
import java.util.Arrays;
class Test {
Object[] myOs;
int[][] myIIs;
int[] myIs;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final Test test = (Test) o;
// Compare nested arrays - values of myIIs here
if (!Arrays.equals(myIs, test.myIs)) return false;
// Probably incorrect - comparing Object[] arrays with Arrays.equals
if (!Arrays.equals(myOs, test.myOs)) return false;
return true;
}
public int hashCode() {
int result = myOs != null ? Arrays.hashCode(myOs) : 0;
result = 31 * result + (myIIs != null ? Arrays.hashCode(myIIs) : 0);
result = 31 * result + (myIs != null ? Arrays.hashCode(myIs) : 0);
return result;
}
}
@@ -0,0 +1,22 @@
class Test {
int i;
Test a;
Test b;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final Test test = (Test) o;
if (i != test.i) return false;
if (!a.equals(test.a)) return false;
if (b != null ? !b.equals(test.b) : test.b != null) return false;
return true;
}
public int hashCode() {
return 0;
}
}
@@ -0,0 +1,31 @@
class Test {
int i;
Test a;
Test b;
double c;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final Test test = (Test) o;
if (Double.compare(test.c, c) != 0) return false;
if (i != test.i) return false;
if (!a.equals(test.a)) return false;
if (b != null ? !b.equals(test.b) : test.b != null) return false;
return true;
}
public int hashCode() {
int result;
long temp;
result = i;
result = 31 * result + a.hashCode();
result = 31 * result + (b != null ? b.hashCode() : 0);
temp = c != +0.0d ? Double.doubleToLongBits(c) : 0L;
result = 31 * result + (int) (temp ^ (temp >>> 32));
return result;
}
}
@@ -0,0 +1,20 @@
class Test {
int i;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final Test test = (Test) o;
if (i != test.i) return false;
return true;
}
@Override
public int hashCode() {
return i;
}
}
@@ -0,0 +1,20 @@
class Integer {
int i;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final Integer integer = (Integer) o;
if (i != integer.i) return false;
return true;
}
@Override
public int hashCode() {
return i;
}
}
@@ -0,0 +1,24 @@
class Test {
void foo() {
class Integer {
int i;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final Integer integer = (Integer) o;
if (i != integer.i) return false;
return true;
}
@Override
public int hashCode() {
return i;
}
}
}
}
@@ -0,0 +1,12 @@
public class Test {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
return true;
}
public int hashCode() {
return 0;
}
}
@@ -0,0 +1,18 @@
class Test {
@org.jetbrains.annotations.NotNull Object d;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final Test test = (Test) o;
if (d != null ? !d.equals(test.d) : test.d != null) return false;
return true;
}
public int hashCode() {
return d != null ? d.hashCode() : 0;
}
}
@@ -0,0 +1,19 @@
class Test {
double d;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final Test test = (Test) o;
if (Double.compare(test.d, d) != 0) return false;
return true;
}
public int hashCode() {
final long temp = d != +0.0d ? Double.doubleToLongBits(d) : 0L;
return (int) (temp ^ (temp >>> 32));
}
}
@@ -0,0 +1,18 @@
class Test {
Object d;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final Test test = (Test) o;
if (d != null ? !d.equals(test.d) : test.d != null) return false;
return true;
}
public int hashCode() {
return d != null ? d.hashCode() : 0;
}
}
@@ -0,0 +1,18 @@
class Test {
float d;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final Test test = (Test) o;
if (Float.compare(test.d, d) != 0) return false;
return true;
}
public int hashCode() {
return (d != +0.0f ? Float.floatToIntBits(d) : 0);
}
}
@@ -0,0 +1,22 @@
public class Test {
int f;
public int j;
int h;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final Test test = (Test) o;
if (f != test.f) return false;
if (h != test.h) return false;
if (j != test.j) return false;
return true;
}
public int hashCode() {
return 0;
}
}
@@ -0,0 +1,17 @@
abstract class SuperTest {
public boolean equals(Object object) {
return true;
}
public int hashCode() {
return 0;
}
}
class Test extends SuperTest {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
return true;
}
}
@@ -0,0 +1,5 @@
abstract class SuperTest {
public abstract boolean equals(Object object);
}
class Test extends SuperTest {<caret>
}
@@ -0,0 +1,5 @@
class Test {
Object[] myOs;
int[][] myIIs;
int[] myIs;
}
@@ -0,0 +1,5 @@
class Test {
Object[] myOs;
int[][] myIIs;
int[] myIs;
}
@@ -0,0 +1,5 @@
class Test {
int i;
Test a;
Test b;
}
@@ -0,0 +1,6 @@
class Test {
int i;
Test a;
Test b;
double c;
}
@@ -0,0 +1,3 @@
class Test {
int i;
}
@@ -0,0 +1,3 @@
class Integer {
int i;
}
@@ -0,0 +1,7 @@
class Test {
void foo() {
class Integer {
<caret>int i;
}
}
}
@@ -0,0 +1,2 @@
public class Test {<caret>
}
@@ -0,0 +1,3 @@
class Test {
@org.jetbrains.annotations.NotNull Object d;
}
@@ -0,0 +1,3 @@
class Test {
double d;
}
@@ -0,0 +1,3 @@
class Test {
Object d;
}
@@ -0,0 +1,3 @@
class Test {
float d;
}
@@ -0,0 +1,5 @@
public class Test {<caret>
int f;
public int j;
int h;
}
@@ -0,0 +1,10 @@
abstract class SuperTest {
public boolean equals(Object object) {
return true;
}
public int hashCode() {
return 0;
}
}
class Test extends SuperTest {<caret>
}