Coder Social home page Coder Social logo

pgdp-tests-ws21-22's Introduction

PGdP-Tests-WS21-22

PGdP-Tests-WS21/22 is a student-created repository used to share code tests.

Final Words

Due to the end of this module, this repository will be closed down. Special shoutout to everybody, who was involved in this project.


"Legal status"

Es ist alles erlaubt, was die Lösung nicht verrät.

The so-called Übungsleitung will have an eye on this repository. But as long as the tests do not reveal the solution of the homework, this repository will be tolerated. To ensure the solution is not getting revealed, the tests should be Input/Output-Tests.

The Übungsleitung is not responsible for this repository. Therefore no support is given by the Übungsleitung. Just use the Issue feature here.

Examples:

correct:

// Test Area calculation
// Arrange
Rectangle r1 = new Rectangle(length: 4, width: 4)
// Act & Assert
assertEquals(16, r1.calculateArea());

wrong!:

// Test Area calculation
// Arrange
Rectangle r1 = new Rectangle(length: 4, width: 6)
// Act & Assert
// Calculate using length * width             // <-- reveales the solution
assertEquals(4*6, r1.calculateArea()); // <-- reveales the solution

Usage

  1. Clone this repository
git clone https://github.com/LadnerJonas/PGdP-Tests-WS21-22.git
  1. Check for updates
git pull
  1. Add the test folder to your src-folder of your artemis java project

    Or use the syslink instruction below.

  2. Make sure your IDE (e.g. IntelIJ or Eclipse) sees your added files

  3. Include JUnit to your Project by pressing the red lightbulb (or ALT + ENTER in IntelIJ) on one of the red underlined @Test Annotations in the test file.

image

  1. Do not add them to your artemis git repository
  2. Run the tests and check your mistakes

image

image

Important note

As this is a student-driven project please keep in mind that mistakes can happen. If you think a test is wrong, please feel free to open an Issue (it is easy!). To help fixing bugs, please add following info to your Issue:

  • Operating system
  • IDE (IntelIJ, Eclipse, ...)
  • Where is the mistake / error
  • Citation of the homework instruction

How to use syslinks (Advanced Users only!)

Windows

This has to be executed in the command line, run as administrator:

$ mklink /d \path\to\src\tests \path\to\repository\tests

Linux/MacOS

$ ln -s /path/to/repository/tests /path/to/src/

Shoutout to the Contributors of the TUM_GAD_Tests_SS21-Repository for this great tip!


How to contribute

  1. Fork Repository (Github Documentation)
  2. Add / edit tests under <EXERCISE>/src/test
  3. Ensure no solution or homework-code is getting revealed
  4. Commit and push to your fork repository
  5. Open a Pull Request to this repository (Github Documentation)
  6. Wait until the changes are merged

Helpful links

Write Tests using JUnit 5

How to use Git

How to use Github


Contact

Feel free to contact me via email, but consider using google beforehand:

[email protected]


pgdp-tests-ws21-22's People

Contributors

0xreself avatar 16domsim avatar antecrescent avatar dorianim avatar ewelohd avatar flooxo avatar jpx3 avatar ladnerjonas avatar mariusdkm avatar nkrofta avatar paulzhng avatar philippspohn avatar rank-p avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pgdp-tests-ws21-22's Issues

Testfall stellt höhere Anforderungen als Spezifikation: 118264581564861424L > 10¹⁷

Homework Number: W04H01

In der Spezifikation steht, dass isCentralBin bei Eingaben bis n kleiner gleich 10¹⁷ funktionieren soll. Getestet wird hier aber ein Fall größer als 10¹⁷.

Citation of the homework instruction:
[...]
isCentralBin:
[...]
Eingaben mit n≤10¹⁷ müssen korrekt und effizient behandelt werden.

Testfall
Arguments.of(118264581564861424L, true)

In meinem Fall macht tatsächlich genau das den Unterschied^^

isOrderFulfilledAmountOrder

Homework Number W06H01:

TradeOrderAndHeirsTest:
line 129 should expect true since an order should not be supplied if the order is already fulfilled, therefore adding order in line 127 should not make a difference.

W12H01 test, getComputeThreadCounter

W12H01 tests:

Is it possible that the tests don't consider the following scenario? https://zulip.in.tum.de/#narrow/stream/893-PGdP-W12H01--.20Parallel.20PinguMath/topic/.E2.9C.94.20ComputeThreadCounter
It seems like testMinDim, testMultithreadingAddition, and testMultithreadingMultiplication expect the getComputerThreadCounter to be 4/8, but it's possible to have 5/9 if a thread has been started as described in the Zulip post.

Sorry if this has been mentioned somewhere else, and thanks for the tests :)

W08H01: Early Homework clone results in a ArrayIndexOutOfBoundsException

Homework Number: W08H01

Citation of the homework instruction: -

Additional Information:
Depending on your homework start date one line (number 61) in MazeParser has to be replaced:

Maze.TileState[][] tiles = new Maze.TileState[lines[0].length()][lines.length];

to

Maze.TileState[][] tiles = new Maze.TileState[lines.length][lines[0].length()];

Keep in mind, that you should not push these changes. No warranty is given.

toString TradeOrder

Homework Number (example: W06H01):

Citation of the homework instruction:
toString: TradeOrder: Die⎵Bestellung(Einzeln)⎵hat⎵ein⎵Gesamtgewicht⎵von⎵g⎵und⎵kostet⎵PD.

Der Wert eines PinguFood-Objekts berechnet sich durch weight*ppg

Additional Information:
Ich habe das so verstanden, dass totalCost nicht die Kosten pro Gramm sind, wie es in den Tests suggeriert wird, sondern der Preis der ganzen Bestellung, also für 200g mit einem Preis von 2, dann 400PD.

Englisch:
I understood it to mean that totalCost is not the cost per gram, as suggested in the tests, but the price of the entire order, i.e. for 200g with a price of 2, then 400PD.

edit: Der Wert eines PinguFood-Objekts berechnet sich durch weight*ppg

W03H01 - Warum null als Datum?

Hi, ich verstehe nicht warum beim AuthorTest bei testEquals() beim letzten Testfall null für birthday angegeben wird. Das führt doch normalerweise zu einer NullPointerException.

assertFalse(AUTHOR.equals(new Author("Max", "Mustermann", "Pinguinstraße 1",
                "[email protected]", null)));

In der Angabe wird jedoch nirgends der Fall beschrieben, dass birthday (oder ein anderer Parameter) null ist, warum wird er dann hier auf so ein Fall getestet? Oder hab ich was falsch verstanden?

LG

W08H01: Missing Test: solveMazeFrom impossible path from position to exit

Homework Number: W08H01

Citation of the homework instruction:

static Path solveMazeFrom(Maze maze, Position position):
[....]
Sollte ein solcher Pfad nicht mehr existieren, soll null zurückgegeben werden.

Additional Information:

Maze
[....]
du kannst aber davon ausgehen, dass der exit immer vom entrance aus erreichbar ist.

Position can be != Entrance, and thus, this case has to be tested aswell.
#33

Thanks @mani 🏅

Change assessment of insert()

Homework Number W09H01

Citation of the homework instruction:
insert() Falls ein gleiches Tupel bereits vorhanden ist, wird das übergebene Tupel verworfen. Es soll das Tupel zurückgegeben werden, welches letztendlich im Pool gespeichert ist.

Additional Information:
If I understand assertEquals() correctly, it assesses the equality of the given tuples. For that, it uses our implementation of tuple.equals(other). What we want though, is an assessment of identity.

This should fail, but does not:
assertEquals(tuple0Duplicate, pool0.insert(tuple0Duplicate));

I suggest, we change the test according to this example:

assertEquals(tuple0, pool0.insert(tuple0Duplicate)); //old

/* assertEquals(expected, test of identity) */
assertEquals(true, pool0.insert(tuple0Duplicate) == tuple0);
assertEquals(false, pool0.insert(tuple0Duplicate) == tuple0Duplicate);

Fälschlicherweise werden 2 leeren Zeilen nach Ausgabe erwartet

UnitTests W02H02, MarketEndDayPropertiesTest:
Assert.assertEquals("Der Laden der Saleuine Claudia und Karl-Heinz hat am 2. Tag 85.0PD eingenommen." + System.lineSeparator() + "Dafür wurden 1 Krustentiere, 2 Sardellen und 3 Sardinen verkauft." + System.lineSeparator() + "Insgesamt hat der Laden 255.0PD eingenommen.\n" + System.lineSeparator(), outputStreamCaptor.toString().substring(0, (outputStreamCaptor.toString()).length() - 2));

Nach dem '\n' kommt noch ein lineseparator und demnach werden 2 leere Zeilen nach der Ausgabe erwartet, auch wenn in der Aufgabenstellung steht, dass man nur eine haben sollte.

W04H02: AuthorTest schlagen bei gewisser Zeit fehl

Wenn man die Methode getAgeTest() in AuthorTest zwischen 0:00Uhr und 1:00Uhr ausführt, schägt diese, trotz richtiger Implementierung, fehl.

Dies liegt am zweiten Test, welcher wie folgt aussieht:

Author author2 = new Author("Max", "Mustermann", "Garching-City", "[email protected]", new Date(LocalDate.now().getDayOfMonth(), LocalDate.now().getMonthValue(), LocalDate.now().getYear()));
assertEquals(0, author2.getAge());

Bei diesem Test wird LocalDate.now() benutzt, um das aktuelle Datum zu bekommen. Allerdings wird dieses Datum anhand der lokalen Zeitzone gebildet (UTC+1). Die Klassen sollen allerdings in UTC +0 getestet werden.

Um das Problem zu beheben, schlage ich vor LocalDate.now() mit LocalDate.now(ZoneOffset.UTC) auszutauschen, sodass die Klasse so aussieht:

import java.time.ZoneOffset;
...
public class AuthorTest {
    ...
    Author author2 = new Author("Max", "Mustermann", "Garching-City", "[email protected]", new Date(LocalDate.now(ZoneOffset.UTC).getDayOfMonth(), LocalDate.now(ZoneOffset.UTC).getMonthValue(), LocalDate.now(ZoneOffset.UTC).getYear()));
    assertEquals(0, author2.getAge());
    ...
}

Alternativ könnte auch die Methode today() von der Klasse Date benutzt werden:

public class AuthorTest {
    ...
    Author author2 = new Author("Max", "Mustermann", "Garching-City", "[email protected]", new Date(Date.today().getDay(), Date.today().getMonth(), Date.today().getYear()));
    assertEquals(0, author2.getAge());
    ...
}

new issue

Homework Number (example: W04H01):
W12H01
Citation of the homework instruction:

Additional Information:
testMultiplication and addition are failing for me (the first ones) but the other pass.So i wanted to ask what do they test exactly

LinkedDocumentCollectionTest

Homework Number W0701

line 109.
Meiner Meinung nach sollte size 5 und nicht 4 sein. Wir haben vor line 108 3 LinkedDocuments und 1 DummyLinked(Adresse abc) in der Sammlung. Allerdings entfernt die add Methode keine Dummy Elemente? Zumindest kann ich das der Aufgabenstellung nicht entnehmen. Folglich sollte also in der Collection einfach ein LinkedDocument eingefügt werden, welches die gleiche Addresse wie das DummyElement hat.

registerUnusedFoodTest implemented incorrectly

Homework Number (example: W06H01):

PinguFoodLogisticsTest.java line 47:

wrong assumption about wasted food, statistic shall not be set to zero after clearing orderBook.
Right would be:
"Bisher konnten 15 Tiere mit einem Gesamtgewicht von 2373g nicht verwertet werden.
Claudia und Karl-Heinz ist dadurch ein Profit von 35595PD entgangen."

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.