Write test

This commit is contained in:
Sobottasgithub 2026-01-14 08:50:53 +01:00
parent 404d0bd3b3
commit 7858b01653
2 changed files with 21 additions and 11 deletions

View File

@ -25,8 +25,6 @@ public class LinkedList {
public void toNext() {
if (hasAccess()) {
current = current.getNextNode();
} else {
toFirst();
}
}
@ -67,8 +65,8 @@ public class LinkedList {
newNode.setNextNode(current.getNextNode());
current.setNextNode(newNode);
size++;
}
size++;
}
public void remove() {

View File

@ -3,14 +3,26 @@ public class Main {
Weapon weapon1 = new Weapon("dagger", 12);
Weapon weapon2 = new Weapon("sword", 10);
Weapon weapon3 = new Weapon("bow", 1);
Hero hero = new Hero("held", 12);
/*
hero.addWeapon(weapon1);
hero.addWeapon(weapon2);
hero.addWeapon(weapon3);
hero.chooseWeapon(weapon3);
*/
LinkedList linkedList = new LinkedList();
System.out.println(linkedList.isEmpty());
System.out.println(linkedList.hasAccess());
System.out.println("Append:");
linkedList.append(weapon1);
System.out.println("Insert:");
linkedList.insert(weapon2);
System.out.println(linkedList.getSize());
System.out.println(linkedList.hasAccess());
System.out.println("Append:");
linkedList.append(weapon3);
linkedList.toFirst();
linkedList.toLast();
linkedList.toNext();
System.out.println(linkedList.getFirst());
System.out.println(linkedList.getLast());
linkedList.remove();
}
}