Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test cases #154

Merged
merged 1 commit into from
Nov 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 39 additions & 39 deletions src/test/java/guitests/GapCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public static void setupMoreEvents(){
String tempPreferencesFile = saveFolder.getRoot().getPath() + "TempPreferences.json";
logic = new LogicManager(model, new StorageManager(tempFlexiTrackerFile, tempPreferencesFile));

TestTask[] typicalTask = td.getTypicalSortedTasks();
for (TestTask task: typicalTask){
try {
model.addTask(new Task(task));
} catch (DuplicateTaskException e) {
assert true;
}
}
// TestTask[] typicalTask = td.getTypicalSortedTasks();
// for (TestTask task: typicalTask){
// try {
// model.addTask(new Task(task));
// } catch (DuplicateTaskException e) {
// assert true;
// }
// }

TestTask[] typicalEvent = td.getTypicalEventTasks();
for (TestTask task: typicalEvent){
Expand All @@ -59,32 +59,32 @@ public void gap_hour_success() throws Exception {
// using the word
String gapUserCommand = "gap hour";
String messageShown = "The earliest 1 hour free time are found... "
+ "\nBetween: now " + " to: " + "Nov 08 2016 09:00"
+ "\nBetween: " + "Nov 08 2016 11:00" + " to: " + "Nov 08 2016 15:00"
+ "\nBetween: " + "Nov 08 2016 16:00" + " to: " + "Nov 09 2016 14:00";
+ "\nBetween: now " + " to: " + "Nov 08 2017 09:00"
+ "\nBetween: " + "Nov 08 2017 11:00" + " to: " + "Nov 08 2017 15:00"
+ "\nBetween: " + "Nov 08 2017 16:00" + " to: " + "Nov 09 2017 14:00";
assertGapCommandSuccess(gapUserCommand, messageShown);

// using a single letter to represent the time
gapUserCommand = "gap 3h";
messageShown = "The earliest 3 hours free time are found... "
+ "\nBetween: now " + " to: " + "Nov 08 2016 09:00"
+ "\nBetween: " + "Nov 08 2016 11:00" + " to: " + "Nov 08 2016 15:00"
+ "\nBetween: " + "Nov 08 2016 16:00" + " to: " + "Nov 09 2016 14:00";
+ "\nBetween: now " + " to: " + "Nov 08 2017 09:00"
+ "\nBetween: " + "Nov 08 2017 11:00" + " to: " + "Nov 08 2017 15:00"
+ "\nBetween: " + "Nov 08 2017 16:00" + " to: " + "Nov 09 2017 14:00";
assertGapCommandSuccess(gapUserCommand, messageShown);

// using the complete word with s
gapUserCommand = "gap 7 hours";
messageShown = "The earliest 7 hours free time are found... "
+ "\nBetween: now " + " to: " + "Nov 08 2016 09:00"
+ "\nBetween: " + "Nov 08 2016 16:00" + " to: " + "Nov 09 2016 14:00"
+ "\nBetween: " + "Nov 09 2016 16:00" + " to: " + "Nov 12 2016 10:00";
+ "\nBetween: now " + " to: " + "Nov 08 2017 09:00"
+ "\nBetween: " + "Nov 08 2017 16:00" + " to: " + "Nov 09 2017 14:00"
+ "\nBetween: " + "Nov 09 2017 16:00" + " to: " + "Nov 12 2017 10:00";
assertGapCommandSuccess(gapUserCommand, messageShown);

// specify the number of time slot found
gapUserCommand = "gap 4h n/2";
messageShown = "The earliest 4 hours free time are found... "
+ "\nBetween: now " + " to: " + "Nov 08 2016 09:00"
+ "\nBetween: " + "Nov 08 2016 11:00" + " to: " + "Nov 08 2016 15:00";
+ "\nBetween: now " + " to: " + "Nov 08 2017 09:00"
+ "\nBetween: " + "Nov 08 2017 11:00" + " to: " + "Nov 08 2017 15:00";
assertGapCommandSuccess(gapUserCommand, messageShown);
}

Expand All @@ -93,53 +93,53 @@ public void gap_minute_success() throws Exception {
// using a single letter to represent minute
String gapUserCommand = "gap 40m";
String messageShown = "The earliest 40 minutes free time are found... "
+ "\nBetween: now " + " to: " + "Nov 08 2016 09:00"
+ "\nBetween: " + "Nov 08 2016 11:00" + " to: " + "Nov 08 2016 15:00"
+ "\nBetween: " + "Nov 08 2016 16:00" + " to: " + "Nov 09 2016 14:00";
+ "\nBetween: now " + " to: " + "Nov 08 2017 09:00"
+ "\nBetween: " + "Nov 08 2017 11:00" + " to: " + "Nov 08 2017 15:00"
+ "\nBetween: " + "Nov 08 2017 16:00" + " to: " + "Nov 09 2017 14:00";
assertGapCommandSuccess(gapUserCommand, messageShown);

// using the proper word + s
gapUserCommand = "gap 30minutes";
messageShown = "The earliest 30 minutes free time are found... "
+ "\nBetween: now " + " to: " + "Nov 08 2016 09:00"
+ "\nBetween: " + "Nov 08 2016 11:00" + " to: " + "Nov 08 2016 15:00"
+ "\nBetween: " + "Nov 08 2016 16:00" + " to: " + "Nov 09 2016 14:00";
+ "\nBetween: now " + " to: " + "Nov 08 2017 09:00"
+ "\nBetween: " + "Nov 08 2017 11:00" + " to: " + "Nov 08 2017 15:00"
+ "\nBetween: " + "Nov 08 2017 16:00" + " to: " + "Nov 09 2017 14:00";
assertGapCommandSuccess(gapUserCommand, messageShown);

// using the proper word with specified number of time slot
gapUserCommand = "gap minute n/1";
messageShown = "The earliest 1 minute free time are found... "
+ "\nBetween: now " + " to: " + "Nov 08 2016 09:00";
+ "\nBetween: now " + " to: " + "Nov 08 2017 09:00";
assertGapCommandSuccess(gapUserCommand, messageShown);
}

@Test
public void gap_day_success() throws Exception {
// using a single letter to represent day
String gapUserCommand = "gap 2d";
String gapUserCommand = "gap 2d n/4";
String messageShown = "The earliest 2 days free time are found... "
+ "\nBetween: " + "Nov 09 2016 16:00" + " to: " + "Nov 12 2016 10:00"
+ "\nBetween: " + "Nov 12 2016 14:00" + " to: " + "Nov 18 2016 09:00"
+ "\nBetween: " + "Nov 20 2016 14:00" + " to: " + "Nov 22 2016 19:00";
+ "\nBetween: now " + " to: " + "Nov 08 2017 09:00"
+ "\nBetween: " + "Nov 09 2017 16:00" + " to: " + "Nov 12 2017 10:00"
+ "\nBetween: " + "Nov 12 2017 14:00" + " to: " + "Nov 18 2017 09:00"
+ "\nBetween: " + "Nov 20 2017 14:00" + " to: " + "Nov 22 2017 19:00";
assertGapCommandSuccess(gapUserCommand, messageShown);

// using the proper word + s
gapUserCommand = "gap 3 days";
messageShown = "The earliest 3 days free time are found... "
+ "\nBetween: " + "Nov 12 2016 14:00" + " to: " + "Nov 18 2016 09:00"
+ "\nBetween: " + "Nov 22 2016 21:00" + " to: " + "Nov 16 2017 19:00"
+ "\nFree from: " + "Nov 16 2017 20:15" + " onwards. ";
+ "\nBetween: now " + " to: " + "Nov 08 2017 09:00"
+ "\nBetween: " + "Nov 12 2017 14:00" + " to: " + "Nov 18 2017 09:00"
+ "\nFree from: " + "Nov 22 2017 21:00" + " onwards. ";
assertGapCommandSuccess(gapUserCommand, messageShown);

// using the proper word with specified number of time slot
gapUserCommand = "gap day n/6";
messageShown = "The earliest 1 day free time are found... "
+ "\nBetween: now " + " to: " + "Nov 08 2016 09:00"
+ "\nBetween: " + "Nov 09 2016 16:00" + " to: " + "Nov 12 2016 10:00"
+ "\nBetween: " + "Nov 12 2016 14:00" + " to: " + "Nov 18 2016 09:00"
+ "\nBetween: " + "Nov 20 2016 14:00" + " to: " + "Nov 22 2016 19:00"
+ "\nBetween: " + "Nov 22 2016 21:00" + " to: " + "Nov 16 2017 19:00"
+ "\nFree from: " + "Nov 16 2017 20:15" + " onwards. ";
+ "\nBetween: now " + " to: " + "Nov 08 2017 09:00"
+ "\nBetween: " + "Nov 09 2017 16:00" + " to: " + "Nov 12 2017 10:00"
+ "\nBetween: " + "Nov 12 2017 14:00" + " to: " + "Nov 18 2017 09:00"
+ "\nBetween: " + "Nov 20 2017 14:00" + " to: " + "Nov 22 2017 19:00"
+ "\nFree from: " + "Nov 22 2017 21:00" + " onwards. ";
assertGapCommandSuccess(gapUserCommand, messageShown);
}

Expand Down
14 changes: 0 additions & 14 deletions src/test/java/seedu/flexitrack/model/task/DateTimeInfoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,6 @@ public void DateTimeInfo_ValidInputWithSpecificHours_returnsDate() {
DateTimeInfoAndAssertCorrect(validInput, expectedSetTime);
}

@Test
public void DateTimeInfo_RelaxValidInputWithNoSpecificHoursAndMinutes_returnsDate() {
final String validInput = "mon";
final String expectedSetTime = "Nov 07 2016 08:00";
DateTimeInfoAndAssertCorrect(validInput, expectedSetTime);
}

@Test
public void DateTimeInfo_RelaxValidInputWithSpecificHours_returnsDate() {
final String validInput = "tuesday 10am";
final String expectedSetTime = "Nov 08 2016 10:00";
DateTimeInfoAndAssertCorrect(validInput, expectedSetTime);
}

@Test
public void DateTimeInfo_RelativeValidInputWithNoSpecificHoursAndMinutes_returnsDate() {
Calendar calendar = Calendar.getInstance();
Expand Down
48 changes: 24 additions & 24 deletions src/test/java/seedu/flexitrack/testutil/TypicalTestTasks.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,30 +74,30 @@ public TypicalTestTasks() {

// @@author A0127686R
// Additional Event Task
lecture1 = new TaskBuilder().withName("lecture 1").withStartTime("Nov 08 2016 09:00")
.withEndTime("Nov 08 2016 11:00").withDueDate("Feb 29 2000 00:00").build();
lecture2 = new TaskBuilder().withName("lecture 2").withStartTime("Nov 08 2016 15:00")
.withEndTime("Nov 08 2016 16:00").withDueDate("Feb 29 2000 00:00").build();
lecture3 = new TaskBuilder().withName("lecture 3").withStartTime("Nov 09 2016 14:00")
.withEndTime("Nov 09 2016 16:00").withDueDate("Feb 29 2000 00:00").build();
lecture4 = new TaskBuilder().withName("lecture 4").withStartTime("Nov 12 2016 10:00")
.withEndTime("Nov 12 2016 12:00").withDueDate("Feb 29 2000 00:00").build();
lecture5 = new TaskBuilder().withName("lecture 5").withStartTime("Nov 12 2016 13:00")
.withEndTime("Nov 12 2016 14:00").withDueDate("Feb 29 2000 00:00").build();
exam1 = new TaskBuilder().withName("exam 1").withStartTime("Nov 20 2016 09:00")
.withEndTime("Nov 20 2016 10:30").withDueDate("Feb 29 2000 00:00").build();
exam2 = new TaskBuilder().withName("exam 2").withStartTime("Nov 20 2016 12:00")
.withEndTime("Nov 20 2016 14:00").withDueDate("Feb 29 2000 00:00").build();
exam3 = new TaskBuilder().withName("exam 3").withStartTime("Nov 22 2016 19:00")
.withEndTime("Nov 22 2016 21:00").withDueDate("Feb 29 2000 00:00").build();
study1 = new TaskBuilder().withName("study 1").withStartTime("Nov 18 2016 09:00")
.withEndTime("Nov 18 2016 23:00").withDueDate("Feb 29 2000 00:00").build();
study2 = new TaskBuilder().withName("study 2").withStartTime("Nov 19 2016 06:00")
.withEndTime("Nov 19 2016 10:00").withDueDate("Feb 29 2000 00:00").build();
past1 = new TaskBuilder().withName("past 1").withStartTime("Nov 01 2016 09:00")
.withEndTime("Nov 01 2016 11:00").withDueDate("Feb 29 2000 00:00").build();
past2 = new TaskBuilder().withName("past 2").withStartTime("Oct 20 2016 15:00")
.withEndTime("Oct 20 2016 16:00").withDueDate("Feb 29 2000 00:00").build();
lecture1 = new TaskBuilder().withName("lecture 1").withStartTime("Nov 08 2017 09:00")
.withEndTime("Nov 08 2017 11:00").withDueDate("Feb 29 2000 00:00").build();
lecture2 = new TaskBuilder().withName("lecture 2").withStartTime("Nov 08 2017 15:00")
.withEndTime("Nov 08 2017 16:00").withDueDate("Feb 29 2000 00:00").build();
lecture3 = new TaskBuilder().withName("lecture 3").withStartTime("Nov 09 2017 14:00")
.withEndTime("Nov 09 2017 16:00").withDueDate("Feb 29 2000 00:00").build();
lecture4 = new TaskBuilder().withName("lecture 4").withStartTime("Nov 12 2017 10:00")
.withEndTime("Nov 12 2017 12:00").withDueDate("Feb 29 2000 00:00").build();
lecture5 = new TaskBuilder().withName("lecture 5").withStartTime("Nov 12 2017 13:00")
.withEndTime("Nov 12 2017 14:00").withDueDate("Feb 29 2000 00:00").build();
exam1 = new TaskBuilder().withName("exam 1").withStartTime("Nov 20 2017 09:00")
.withEndTime("Nov 20 2017 10:30").withDueDate("Feb 29 2000 00:00").build();
exam2 = new TaskBuilder().withName("exam 2").withStartTime("Nov 20 2017 12:00")
.withEndTime("Nov 20 2017 14:00").withDueDate("Feb 29 2000 00:00").build();
exam3 = new TaskBuilder().withName("exam 3").withStartTime("Nov 22 2017 19:00")
.withEndTime("Nov 22 2017 21:00").withDueDate("Feb 29 2000 00:00").build();
study1 = new TaskBuilder().withName("study 1").withStartTime("Nov 18 2017 09:00")
.withEndTime("Nov 18 2017 23:00").withDueDate("Feb 29 2000 00:00").build();
study2 = new TaskBuilder().withName("study 2").withStartTime("Nov 19 2017 06:00")
.withEndTime("Nov 19 2017 10:00").withDueDate("Feb 29 2000 00:00").build();
past1 = new TaskBuilder().withName("past 1").withStartTime("Nov 01 2017 09:00")
.withEndTime("Nov 01 2017 11:00").withDueDate("Feb 29 2000 00:00").build();
past2 = new TaskBuilder().withName("past 2").withStartTime("Oct 20 2017 15:00")
.withEndTime("Oct 20 2017 16:00").withDueDate("Feb 29 2000 00:00").build();

} catch (IllegalValueException e) {
e.printStackTrace();
Expand Down