ASSERT-KTH / ASSERT-KTH/human-eval-java

Incorrect Testing Failures Message

Aperta
#6 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
22
Fork
3
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I've observed that the test reports for some bugs seem to get the “expected“ value and “but was” value obtained reversed.
For example:

Bug_ID: `ADD`

Buggy_Code:
```java
/* Add two numbers x and y
>>> add(2, 3)
5
>>> add(5, 7)
12 */

public class ADD {
public static int add(int x, int y) {
return x | y;
}
}
```

Test Cases:
```java
public class TEST_ADD {
@org.junit.Test(timeout = 3000)
public void test_0() throws java.lang.Exception {
int result = humaneval.buggy.ADD.add(0, 1);
org.junit.Assert.assertEquals(
result, 1
);
}

@org.junit.Test(timeout = 3000)
public void test_1() throws java.lang.Exception {
int result = humaneval.buggy.ADD.add(1, 0);
org.junit.Assert.assertEquals(
result, 1
);
}

@org.junit.Test(timeout = 3000)
public void test_2() throws java.lang.Exception {
int result = humaneval.buggy.ADD.add(2, 3);
org.junit.Assert.assertEquals(
result, 5
);
}

@org.junit.Test(timeout = 3000)
public void test_3() throws java.lang.Exception {
int result = humaneval.buggy.ADD.add(5, 7);
org.junit.Assert.assertEquals(
result, 12
);
}

@org.junit.Test(timeout = 3000)
public void test_4() throws java.lang.Exception {
int result = humaneval.buggy.ADD.add(7, 5);
org.junit.Assert.assertEquals(
result, 12
);
}
}
```

Current (Incorrect) Testing Failures Message:
```
Tests run: 5, Failures: 3, Errors: 0, Skipped: 0, Time elapsed: 0.032 s <<< FAILURE! - in humaneval.TEST_ADD
test_2(humaneval.TEST_ADD) Time elapsed: 0 s <<< FAILURE!
java.lang.AssertionError: expected:<3> but was:<5>
at humaneval.TEST_ADD.test_2(TEST_ADD.java:23)

test_3(humaneval.TEST_ADD) Time elapsed: 0 s <<< FAILURE!
java.lang.AssertionError: expected:<7> but was:<12>
at humaneval.TEST_ADD.test_3(TEST_ADD.java:31)

test_4(humaneval.TEST_ADD) Time elapsed: 0 s <<< FAILURE!
java.lang.AssertionError: expected:<7> but was:<12>
at humaneval.TEST_ADD.test_4(TEST_ADD.java:39)
```

Correct Testing Failures Message:
```
Tests run: 5, Failures: 3, Errors: 0, Skipped: 0, Time elapsed: 0.032 s <<< FAILURE! - in humaneval.TEST_ADD
test_2(humaneval.TEST_ADD) Time elapsed: 0 s <<< FAILURE!
java.lang.AssertionError: expected:<5> but was:<3>
at humaneval.TEST_ADD.test_2(TEST_ADD.java:23)

test_3(humaneval.TEST_ADD) Time elapsed: 0 s <<< FAILURE!
java.lang.AssertionError: expected:<12> but was:<7>
at humaneval.TEST_ADD.test_3(TEST_ADD.java:31)

test_4(humaneval.TEST_ADD) Time elapsed: 0 s <<< FAILURE!
java.lang.AssertionError: expected:<12> but was:<7>
at humaneval.TEST_ADD.test_4(TEST_ADD.java:39)
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Riproduci l’esempio ADD utilizzando i casi di test Java mostrati e confronta i messaggi di errore attuali con quelli corretti. Traccia il punto di ingresso del test o della generazione del report responsabile della formattazione degli errori di asserzione; il lavoro è completato quando i test falliti etichettano il valore previsto come expected e il valore restituito come actual.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
testing
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.