Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Lots of different non-functional cleanups and improvements #33

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/test-request.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
name: Test request
about: Suggest a new test case
about: Suggest a new test case or changes to an existing test
title: ''
labels: enhancement
assignees: ''

---

**Is your test request linked to a subexercise? Please describe**
A clear and concise description of the exercise
**Is your test request linked to a subexercise? Please describe:**
A clear and concise description of the exercise.

**Describe the behaviour you want**
**Describe the behaviour you want:**
A clear and concise description of what you want to happen.
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
**Shortly describe your proposed changes:**



**Link any issues if they have led to changes in the request:**



**Note the (sub-)exercises the tests are meant for:**

* GAD <N>
20 changes: 19 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
*.jar
*.class
*.iml
*.iws
*.war
*.ear
*.tmp
*.bak
*.swp
*.launch
*~.nib
.project
GAD 4 - Simple Hashing/tests/simplehash/TestGenerator.java
.idea
.metadata
.settings
.externalToolBuilders
.factorypath
.buildpath
.DS_Store
local.properties
11 changes: 0 additions & 11 deletions .project

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import static org.junit.jupiter.api.Assertions.*;

public class BinSea {
public class BinSeaTester {

/**
* Tests from examples from exercise 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,90 +1,91 @@
package gad.binarysearch;
package tests.binarysearch;

import gad.binarysearch.Interval;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import static gad.binarysearch.BinSea.search;

public class IntervalSearchTest {
public class IntervalSearchTester {

@Test
void test1(){
Interval expected = new Interval.NonEmptyInterval(2,4);
Interval actual = search(new int[]{1, 27, 100, 127, 3000}, new Interval.NonEmptyInterval(80, 10000), new StudentResult(), new StudentResult());
Interval actual = search(new int[]{1, 27, 100, 127, 3000}, new Interval.NonEmptyInterval(80, 10000), new TestResult(), new TestResult());
Assertions.assertEquals(expected,actual);
}

@Test
void test2(){
Interval expected = new Interval.NonEmptyInterval(0,4);
Interval actual = search(new int[]{1, 27, 100, 127, 3000}, new Interval.NonEmptyInterval(0, 10000), new StudentResult(), new StudentResult());
Interval actual = search(new int[]{1, 27, 100, 127, 3000}, new Interval.NonEmptyInterval(0, 10000), new TestResult(), new TestResult());
Assertions.assertEquals(expected,actual);
}
@Test
void test3(){
Interval expected = new Interval.NonEmptyInterval(0,4);
Interval actual = search(new int[]{1, 27, 100, 127, 3000}, new Interval.NonEmptyInterval(-10, 10000), new StudentResult(), new StudentResult());
Interval actual = search(new int[]{1, 27, 100, 127, 3000}, new Interval.NonEmptyInterval(-10, 10000), new TestResult(), new TestResult());
Assertions.assertEquals(expected,actual);
}
@Test
void test4(){
Interval expected = new Interval.NonEmptyInterval(0,4);
Interval actual = search(new int[]{1, 1, 1, 1, 1}, new Interval.NonEmptyInterval(1, 1), new StudentResult(), new StudentResult());
Interval actual = search(new int[]{1, 1, 1, 1, 1}, new Interval.NonEmptyInterval(1, 1), new TestResult(), new TestResult());
Assertions.assertEquals(expected,actual);
}
@Test
void test5(){
Interval expected = Interval.EmptyInterval.getEmptyInterval();
Interval actual = search(new int[]{}, new Interval.NonEmptyInterval(-10, 10000), new StudentResult(), new StudentResult());
Interval actual = search(new int[]{}, new Interval.NonEmptyInterval(-10, 10000), new TestResult(), new TestResult());
Assertions.assertEquals(expected,actual);
}

@Test
void test6(){
Interval expected = Interval.EmptyInterval.getEmptyInterval();
Interval actual = search(new int[]{-100, -50, -20, 10100, 10200}, new Interval.NonEmptyInterval(-10, 10000), new StudentResult(), new StudentResult());
Interval actual = search(new int[]{-100, -50, -20, 10100, 10200}, new Interval.NonEmptyInterval(-10, 10000), new TestResult(), new TestResult());
Assertions.assertEquals(expected,actual);
}

@Test
void test7(){
Interval expected = new Interval.NonEmptyInterval(1,5);
Interval actual = search(new int[]{-150, -100, -50, -20, 10100, 10200}, new Interval.NonEmptyInterval(-100, 10200), new StudentResult(), new StudentResult());
Interval actual = search(new int[]{-150, -100, -50, -20, 10100, 10200}, new Interval.NonEmptyInterval(-100, 10200), new TestResult(), new TestResult());
Assertions.assertEquals(expected,actual);
}

@Test
void test8(){
Interval expected = new Interval.NonEmptyInterval(0,3);
Interval actual = search(new int[]{-10, -10, 10000, 10000}, new Interval.NonEmptyInterval(-10, 10000), new StudentResult(), new StudentResult());
Interval actual = search(new int[]{-10, -10, 10000, 10000}, new Interval.NonEmptyInterval(-10, 10000), new TestResult(), new TestResult());
Assertions.assertEquals(expected,actual);
}

@Test
void test9(){
Interval expected = new Interval.NonEmptyInterval(1,6);
Interval actual = search(new int[]{-12, 0, 0, 0, 0, 0, 0, 12}, new Interval.NonEmptyInterval(-10, 10), new StudentResult(), new StudentResult());
Interval actual = search(new int[]{-12, 0, 0, 0, 0, 0, 0, 12}, new Interval.NonEmptyInterval(-10, 10), new TestResult(), new TestResult());
Assertions.assertEquals(expected,actual);
}

@Test
void test10(){
Interval expected = new Interval.NonEmptyInterval(7,7);
Interval actual = search(new int[]{-12, 0, 0, 0, 0, 0, 0, 12}, new Interval.NonEmptyInterval(1, 15), new StudentResult(), new StudentResult());
Interval actual = search(new int[]{-12, 0, 0, 0, 0, 0, 0, 12}, new Interval.NonEmptyInterval(1, 15), new TestResult(), new TestResult());
Assertions.assertEquals(expected,actual);
}

@Test
void test11(){
Interval expected = new Interval.NonEmptyInterval(0,0);
Interval actual = search(new int[]{-12, 0, 0, 0, 0, 0, 0, 12}, new Interval.NonEmptyInterval(-12, -1), new StudentResult(), new StudentResult());
Interval actual = search(new int[]{-12, 0, 0, 0, 0, 0, 0, 12}, new Interval.NonEmptyInterval(-12, -1), new TestResult(), new TestResult());
Assertions.assertEquals(expected,actual);
}

@Test
void test12(){
Interval expected = new Interval.NonEmptyInterval(0,0);
Interval actual = search(new int[]{1}, new Interval.NonEmptyInterval(1,1), new StudentResult(), new StudentResult());
Interval actual = search(new int[]{1}, new Interval.NonEmptyInterval(1,1), new TestResult(), new TestResult());
Assertions.assertEquals(expected,actual);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
import java.util.Random;

/**
* Tests included from Zulip: https://zulip.in.tum.de/#narrow/stream/419-GAD-E03-Dynamisches.20Array/topic/Tests/near/177724
* @Author Aamin Dev
CrsiX marked this conversation as resolved.
Show resolved Hide resolved
* Tests included from Zulip:
* https://zulip.in.tum.de/#narrow/stream/419-GAD-E03-Dynamisches.20Array/topic/Tests/near/177724
* @author Aamin
*/
class TestForDynamicArray {
class DynamicArrayTester {

@Test
void testIllegalArguments() {
Expand Down Expand Up @@ -435,5 +436,4 @@ void ringQueueBrutalLoop() {
}

}

}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package gad.dynamicarray;
package tests.dynamicarray;

import static org.junit.jupiter.api.Assertions.assertTrue;

import gad.dynamicarray.DynamicStack;
import org.junit.jupiter.api.Test;

public class TestForDynamicStack {
public class DynamicStackTester {

@Test
void defaultTest() {
DynamicStack ds = new DynamicStack(3, 4, new StudentResult());
DynamicStack ds = new DynamicStack(3, 4, new TestResult());
ds.insert(1);
assertTrue(ds.toString().equals("[1, 0, 0], length: 1"));
ds.insert(2);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package gad.dynamicarray;
package tests.dynamicarray;

import static org.junit.jupiter.api.Assertions.assertTrue;

import gad.dynamicarray.RingQueue;
import org.junit.jupiter.api.Test;

class TestForRingQueue {
class RingQueueTester {

@Test
void test() {
RingQueue r = new RingQueue(3, 4, new StudentResult());
RingQueue r = new RingQueue(3, 4, new TestResult());
r.insert(1);
assertTrue(r.toString().equals("[1, 0, 0], size: 1"));
r.insert(2);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package gad.dynamicarray;
package tests.dynamicarray;

import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import gad.dynamicarray.StackyQueue;
import org.junit.jupiter.api.Test;

class TestForStackyQueue {
class StackyQueueTester {

@Test
void test() {
StackyQueue s = new StackyQueue(3, 4, new StudentResult(), new StudentResult());
StackyQueue s = new StackyQueue(3, 4, new TestResult(), new TestResult());
s.insert(1);
assertTrue(s.toString().equals("[1, 0, 0], length: 1, [], length: 0"));
s.insert(2);
Expand Down