C# - Bob WIP (also backfill some Kotlin)

This commit is contained in:
AnthonyS 2017-08-13 09:44:29 -04:00
parent 620cafefff
commit dfdd24ec7f
16 changed files with 1241 additions and 0 deletions

26
csharp/bob/Bob.cs Normal file
View file

@ -0,0 +1,26 @@
using System;
using System.Linq;
public static class Bob
{
public static string Response(string statement)
{
string trimmedStatement = statement.Trim();
if (trimmedStatement.Length == 0)
{
return "Fine. Be that way!";
}
if (trimmedStatement.Where((char x) => x != ' ' || x != '!' || x != '?').All((char x) => Enumerable.Range('A', 'Z' + 1).Contains(x)) || trimmedStatement.Last() == '!')
{
return "Whoa, chill out!";
}
if (trimmedStatement.Last() == '?')
{
return "Sure.";
}
return "Whatever.";
}
}

18
csharp/bob/Bob.csproj Normal file
View file

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
</ItemGroup>
</Project>

22
csharp/bob/Bob.sln Normal file
View file

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bob", "Bob.csproj", "{E386526F-DD72-45B2-AC91-0F154C9AC37B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E386526F-DD72-45B2-AC91-0F154C9AC37B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E386526F-DD72-45B2-AC91-0F154C9AC37B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E386526F-DD72-45B2-AC91-0F154C9AC37B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E386526F-DD72-45B2-AC91-0F154C9AC37B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

156
csharp/bob/BobTest.cs Normal file
View file

@ -0,0 +1,156 @@
// This file was auto-generated based on version 1.0.0 of the canonical data.
using Xunit;
public class BobTest
{
[Fact]
public void Stating_something()
{
Assert.Equal("Whatever.", Bob.Response("Tom-ay-to, tom-aaaah-to."));
}
[Fact]
public void Shouting()
{
Assert.Equal("Whoa, chill out!", Bob.Response("WATCH OUT!"));
}
[Fact]
public void Shouting_gibberish()
{
Assert.Equal("Whoa, chill out!", Bob.Response("FCECDFCAAB"));
}
[Fact]
public void Asking_a_question()
{
Assert.Equal("Sure.", Bob.Response("Does this cryogenic chamber make me look fat?"));
}
[Fact]
public void Asking_a_numeric_question()
{
Assert.Equal("Sure.", Bob.Response("You are, what, like 15?"));
}
[Fact]
public void Asking_gibberish()
{
Assert.Equal("Sure.", Bob.Response("fffbbcbeab?"));
}
[Fact]
public void Talking_forcefully()
{
Assert.Equal("Whatever.", Bob.Response("Let's go make out behind the gym!"));
}
[Fact]
public void Using_acronyms_in_regular_speech()
{
Assert.Equal("Whatever.", Bob.Response("It's OK if you don't want to go to the DMV."));
}
[Fact]
public void Forceful_question()
{
Assert.Equal("Whoa, chill out!", Bob.Response("WHAT THE HELL WERE YOU THINKING?"));
}
[Fact]
public void Shouting_numbers()
{
Assert.Equal("Whoa, chill out!", Bob.Response("1, 2, 3 GO!"));
}
[Fact]
public void Only_numbers()
{
Assert.Equal("Whatever.", Bob.Response("1, 2, 3"));
}
[Fact]
public void Question_with_only_numbers()
{
Assert.Equal("Sure.", Bob.Response("4?"));
}
[Fact]
public void Shouting_with_special_characters()
{
Assert.Equal("Whoa, chill out!", Bob.Response("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!"));
}
[Fact]
public void Shouting_with_no_exclamation_mark()
{
Assert.Equal("Whoa, chill out!", Bob.Response("I HATE YOU"));
}
[Fact]
public void Statement_containing_question_mark()
{
Assert.Equal("Whatever.", Bob.Response("Ending with ? means a question."));
}
[Fact]
public void Non_letters_with_question()
{
Assert.Equal("Sure.", Bob.Response(":) ?"));
}
[Fact]
public void Prattling_on()
{
Assert.Equal("Sure.", Bob.Response("Wait! Hang on. Are you going to be OK?"));
}
[Fact]
public void Silence()
{
Assert.Equal("Fine. Be that way!", Bob.Response(""));
}
[Fact]
public void Prolonged_silence()
{
Assert.Equal("Fine. Be that way!", Bob.Response(" "));
}
[Fact]
public void Alternate_silence()
{
Assert.Equal("Fine. Be that way!", Bob.Response("\t\t\t\t\t\t\t\t\t\t"));
}
[Fact]
public void Multiple_line_question()
{
Assert.Equal("Whatever.", Bob.Response("\nDoes this cryogenic chamber make me look fat?\nno"));
}
[Fact]
public void Starting_with_whitespace()
{
Assert.Equal("Whatever.", Bob.Response(" hmmmmmmm..."));
}
[Fact]
public void Ending_with_whitespace()
{
Assert.Equal("Sure.", Bob.Response("Okay if like my spacebar quite a bit? "));
}
[Fact]
public void Other_whitespace()
{
Assert.Equal("Fine. Be that way!", Bob.Response("\n\r \t"));
}
[Fact]
public void Non_question_ending_with_whitespace()
{
Assert.Equal("Whatever.", Bob.Response("This is a statement ending with whitespace "));
}
}

24
csharp/bob/README.md Normal file
View file

@ -0,0 +1,24 @@
# Bob
Bob is a lackadaisical teenager. In conversation, his responses are very limited.
Bob answers 'Sure.' if you ask him a question.
He answers 'Whoa, chill out!' if you yell at him.
He says 'Fine. Be that way!' if you address him without actually saying
anything.
He answers 'Whatever.' to anything else.
### Submitting Exercises
Note that, when trying to submit an exercise, make sure the exercise file that you're submitting is in the `exercism/csharp/<exerciseName>` directory.
For example, if you're submitting `bob.cs` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/csharp/bob/bob.cs`.
## Source
Inspired by the 'Deaf Grandma' exercise in Chris Pine's Learn to Program tutorial. [http://pine.fm/LearnToProgram/?Chapter=06](http://pine.fm/LearnToProgram/?Chapter=06)
## Submitting Incomplete Solutions
It's possible to submit an incomplete solution so you can see how others have completed the exercise.

View file

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloWorld", "HelloWorld.csproj", "{E291CE07-3A04-4F1A-B256-ED82960B6BC5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E291CE07-3A04-4F1A-B256-ED82960B6BC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E291CE07-3A04-4F1A-B256-ED82960B6BC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E291CE07-3A04-4F1A-B256-ED82960B6BC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E291CE07-3A04-4F1A-B256-ED82960B6BC5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,12 @@
// This file was auto-generated based on version 1.0.0 of the canonical data.
using Xunit;
public class HelloWorldTest
{
[Fact]
public void Say_hi_()
{
Assert.Equal("Hello, World!", HelloWorld.Hello());
}
}

View file

@ -0,0 +1,27 @@
# Hello World
The classical introductory exercise. Just say "Hello, World!".
["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is
the traditional first program for beginning programming in a new language
or environment.
The objectives are simple:
- Write a function that returns the string "Hello, World!".
- Run the test suite and make sure that it succeeds.
- Submit your solution and check it at the website.
If everything goes well, you will be ready to fetch your first real exercise.
### Submitting Exercises
Note that, when trying to submit an exercise, make sure the exercise file that you're submitting is in the `exercism/csharp/<exerciseName>` directory.
For example, if you're submitting `bob.cs` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/csharp/bob/bob.cs`.
## Source
This is an exercise to introduce users to using Exercism [http://en.wikipedia.org/wiki/%22Hello,_world!%22_program](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program)
## Submitting Incomplete Solutions
It's possible to submit an incomplete solution so you can see how others have completed the exercise.

22
csharp/leap/Leap.csproj Normal file
View file

@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>

22
csharp/leap/Leap.sln Normal file
View file

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Leap", "Leap.csproj", "{B2F64316-6C2A-4FAE-935E-AD23227271B0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B2F64316-6C2A-4FAE-935E-AD23227271B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B2F64316-6C2A-4FAE-935E-AD23227271B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2F64316-6C2A-4FAE-935E-AD23227271B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2F64316-6C2A-4FAE-935E-AD23227271B0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

25
csharp/leap/LeapTest.cs Normal file
View file

@ -0,0 +1,25 @@
// This file was auto-generated based on version 1.0.0 of the canonical data.
using Xunit;
public class LeapTest {
[Fact]
public void Year_not_divisible_by_4_is_common_year() {
Assert.False(Leap.IsLeapYear(2015));
}
[Fact]
public void Year_divisible_by_4_not_divisible_by_100_is_leap_year() {
Assert.True(Leap.IsLeapYear(2016));
}
[Fact]
public void Year_divisible_by_100_not_divisible_by_400_is_common_year() {
Assert.False(Leap.IsLeapYear(2100));
}
[Fact]
public void Year_divisible_by_400_is_leap_year() {
Assert.True(Leap.IsLeapYear(2000));
}
}

39
csharp/leap/README.md Normal file
View file

@ -0,0 +1,39 @@
# Leap
Given a year, report if it is a leap year.
The tricky thing here is that a leap year in the Gregorian calendar occurs:
```plain
on every year that is evenly divisible by 4
except every year that is evenly divisible by 100
unless the year is also evenly divisible by 400
```
For example, 1997 is not a leap year, but 1996 is. 1900 is not a leap
year, but 2000 is.
If your language provides a method in the standard library that does
this look-up, pretend it doesn't exist and implement it yourself.
## Notes
Though our exercise adopts some very simple rules, there is more to
learn!
For a delightful, four minute explanation of the whole leap year
phenomenon, go watch [this youtube video][video].
[video]: http://www.youtube.com/watch?v=xX96xng7sAE
### Submitting Exercises
Note that, when trying to submit an exercise, make sure the exercise file that you're submitting is in the `exercism/csharp/<exerciseName>` directory.
For example, if you're submitting `bob.cs` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/csharp/bob/bob.cs`.
## Source
JavaRanch Cattle Drive, exercise 3 [http://www.javaranch.com/leap.jsp](http://www.javaranch.com/leap.jsp)
## Submitting Incomplete Solutions
It's possible to submit an incomplete solution so you can see how others have completed the exercise.

33
kotlin/meetup/README.md Normal file
View file

@ -0,0 +1,33 @@
# Meetup
Calculate the date of meetups.
Typically meetups happen on the same day of the week. In this exercise, you will take
a description of a meetup date, and return the actual meetup date.
Examples of general descriptions are:
- the first Monday of January 2017
- the third Tuesday of January 2017
- the Wednesteenth of January 2017
- the last Thursday of January 2017
Note that "Monteenth", "Tuesteenth", etc are all made up words. There
was a meetup whose members realized that there are exactly 7 numbered days in a month that
end in '-teenth'. Therefore, one is guaranteed that each day of the week
(Monday, Tuesday, ...) will have exactly one date that is named with '-teenth'
in every month.
Given examples of a meetup dates, each containing a month, day, year, and descriptor
(first, second, teenth, etc), calculate the date of the actual meetup.
For example, if given "First Monday of January 2017", the correct meetup date is 2017/1/2
## Source
Jeremy Hinegardner mentioned a Boulder meetup that happens on the Wednesteenth of every month [https://twitter.com/copiousfreetime](https://twitter.com/copiousfreetime)
## Submitting Incomplete Solutions
It's possible to submit an incomplete solution so you can see how others have completed the exercise.

View file

@ -0,0 +1,5 @@
enum class MeetupSchedule {
FIRST, SECOND, THIRD, FOURTH, LAST, TEENTH
}

View file

@ -0,0 +1,770 @@
import org.junit.Ignore
import org.junit.Test
import java.time.DayOfWeek
import java.time.LocalDate
import kotlin.test.assertEquals
/*
* version: 1.0.0
*/
class MeetupTest {
@Test
fun testMonteenthOfMay2013() {
val expected = LocalDate.of(2013, 5, 13)
val meetup = Meetup(5, 2013)
assertEquals(expected, meetup.day(DayOfWeek.MONDAY, MeetupSchedule.TEENTH))
}
@Test
fun testMonteenthOfAugust2013() {
val expected = LocalDate.of(2013, 8, 19)
val meetup = Meetup(8, 2013)
assertEquals(expected, meetup.day(DayOfWeek.MONDAY, MeetupSchedule.TEENTH))
}
@Test
fun testMonteenthOfSeptember2013() {
val expected = LocalDate.of(2013, 9, 16)
val meetup = Meetup(9, 2013)
assertEquals(expected, meetup.day(DayOfWeek.MONDAY, MeetupSchedule.TEENTH))
}
@Test
fun testTuesteenthOfMarch2013() {
val expected = LocalDate.of(2013, 3, 19)
val meetup = Meetup(3, 2013)
assertEquals(expected, meetup.day(DayOfWeek.TUESDAY, MeetupSchedule.TEENTH))
}
@Test
fun testTuesteenthOfApril2013() {
val expected = LocalDate.of(2013, 4, 16)
val meetup = Meetup(4, 2013)
assertEquals(expected, meetup.day(DayOfWeek.TUESDAY, MeetupSchedule.TEENTH))
}
@Test
fun testTuesteenthOfAugust2013() {
val expected = LocalDate.of(2013, 8, 13)
val meetup = Meetup(8, 2013)
assertEquals(expected, meetup.day(DayOfWeek.TUESDAY, MeetupSchedule.TEENTH))
}
@Test
fun testWednesteenthOfJanuary2013() {
val expected = LocalDate.of(2013, 1, 16)
val meetup = Meetup(1, 2013)
assertEquals(expected, meetup.day(DayOfWeek.WEDNESDAY, MeetupSchedule.TEENTH))
}
@Test
fun testWednesteenthOfFebruary2013() {
val expected = LocalDate.of(2013, 2, 13)
val meetup = Meetup(2, 2013)
assertEquals(expected, meetup.day(DayOfWeek.WEDNESDAY, MeetupSchedule.TEENTH))
}
@Test
fun testWednesteenthOfJune2013() {
val expected = LocalDate.of(2013, 6, 19)
val meetup = Meetup(6, 2013)
assertEquals(expected, meetup.day(DayOfWeek.WEDNESDAY, MeetupSchedule.TEENTH))
}
@Test
fun testThursteenthOfMay2013() {
val expected = LocalDate.of(2013, 5, 16)
val meetup = Meetup(5, 2013)
assertEquals(expected, meetup.day(DayOfWeek.THURSDAY, MeetupSchedule.TEENTH))
}
@Test
fun testThursteenthOfJune2013() {
val expected = LocalDate.of(2013, 6, 13)
val meetup = Meetup(6, 2013)
assertEquals(expected, meetup.day(DayOfWeek.THURSDAY, MeetupSchedule.TEENTH))
}
@Test
fun testThursteenthOfSeptember2013() {
val expected = LocalDate.of(2013, 9, 19)
val meetup = Meetup(9, 2013)
assertEquals(expected, meetup.day(DayOfWeek.THURSDAY, MeetupSchedule.TEENTH))
}
@Test
fun testFriteenthOfApril2013() {
val expected = LocalDate.of(2013, 4, 19)
val meetup = Meetup(4, 2013)
assertEquals(expected, meetup.day(DayOfWeek.FRIDAY, MeetupSchedule.TEENTH))
}
@Test
fun testFriteenthOfAugust2013() {
val expected = LocalDate.of(2013, 8, 16)
val meetup = Meetup(8, 2013)
assertEquals(expected, meetup.day(DayOfWeek.FRIDAY, MeetupSchedule.TEENTH))
}
@Test
fun testFriteenthOfSeptember2013() {
val expected = LocalDate.of(2013, 9, 13)
val meetup = Meetup(9, 2013)
assertEquals(expected, meetup.day(DayOfWeek.FRIDAY, MeetupSchedule.TEENTH))
}
@Test
fun testSaturteenthOfFebruary2013() {
val expected = LocalDate.of(2013, 2, 16)
val meetup = Meetup(2, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SATURDAY, MeetupSchedule.TEENTH))
}
@Test
fun testSaturteenthOfApril2013() {
val expected = LocalDate.of(2013, 4, 13)
val meetup = Meetup(4, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SATURDAY, MeetupSchedule.TEENTH))
}
@Test
fun testSaturteenthOfOctober2013() {
val expected = LocalDate.of(2013, 10, 19)
val meetup = Meetup(10, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SATURDAY, MeetupSchedule.TEENTH))
}
@Test
fun testSunteenthOfMay2013() {
val expected = LocalDate.of(2013, 5, 19)
val meetup = Meetup(5, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SUNDAY, MeetupSchedule.TEENTH))
}
@Test
fun testSunteenthOfJune2013() {
val expected = LocalDate.of(2013, 6, 16)
val meetup = Meetup(6, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SUNDAY, MeetupSchedule.TEENTH))
}
@Test
fun testSunteenthOfOctober2013() {
val expected = LocalDate.of(2013, 10, 13)
val meetup = Meetup(10, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SUNDAY, MeetupSchedule.TEENTH))
}
@Test
fun testFirstMondayOfMarch2013() {
val expected = LocalDate.of(2013, 3, 4)
val meetup = Meetup(3, 2013)
assertEquals(expected, meetup.day(DayOfWeek.MONDAY, MeetupSchedule.FIRST))
}
@Test
fun testFirstMondayOfApril2013() {
val expected = LocalDate.of(2013, 4, 1)
val meetup = Meetup(4, 2013)
assertEquals(expected, meetup.day(DayOfWeek.MONDAY, MeetupSchedule.FIRST))
}
@Test
fun testFirstTuesdayOfMay2013() {
val expected = LocalDate.of(2013, 5, 7)
val meetup = Meetup(5, 2013)
assertEquals(expected, meetup.day(DayOfWeek.TUESDAY, MeetupSchedule.FIRST))
}
@Test
fun testFirstTuesdayOfJune2013() {
val expected = LocalDate.of(2013, 6, 4)
val meetup = Meetup(6, 2013)
assertEquals(expected, meetup.day(DayOfWeek.TUESDAY, MeetupSchedule.FIRST))
}
@Test
fun testFirstWednesdayOfJuly2013() {
val expected = LocalDate.of(2013, 7, 3)
val meetup = Meetup(7, 2013)
assertEquals(expected, meetup.day(DayOfWeek.WEDNESDAY, MeetupSchedule.FIRST))
}
@Test
fun testFirstWednesdayOfAugust2013() {
val expected = LocalDate.of(2013, 8, 7)
val meetup = Meetup(8, 2013)
assertEquals(expected, meetup.day(DayOfWeek.WEDNESDAY, MeetupSchedule.FIRST))
}
@Test
fun testFirstThursdayOfSeptember2013() {
val expected = LocalDate.of(2013, 9, 5)
val meetup = Meetup(9, 2013)
assertEquals(expected, meetup.day(DayOfWeek.THURSDAY, MeetupSchedule.FIRST))
}
@Test
fun testFirstThursdayOfOctober2013() {
val expected = LocalDate.of(2013, 10, 3)
val meetup = Meetup(10, 2013)
assertEquals(expected, meetup.day(DayOfWeek.THURSDAY, MeetupSchedule.FIRST))
}
@Test
fun testFirstFridayOfNovember2013() {
val expected = LocalDate.of(2013, 11, 1)
val meetup = Meetup(11, 2013)
assertEquals(expected, meetup.day(DayOfWeek.FRIDAY, MeetupSchedule.FIRST))
}
@Test
fun testFirstFridayOfDecember2013() {
val expected = LocalDate.of(2013, 12, 6)
val meetup = Meetup(12, 2013)
assertEquals(expected, meetup.day(DayOfWeek.FRIDAY, MeetupSchedule.FIRST))
}
@Test
fun testFirstSaturdayOfJanuary2013() {
val expected = LocalDate.of(2013, 1, 5)
val meetup = Meetup(1, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SATURDAY, MeetupSchedule.FIRST))
}
@Test
fun testFirstSaturdayOfFebruary2013() {
val expected = LocalDate.of(2013, 2, 2)
val meetup = Meetup(2, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SATURDAY, MeetupSchedule.FIRST))
}
@Test
fun testFirstSundayOfMarch2013() {
val expected = LocalDate.of(2013, 3, 3)
val meetup = Meetup(3, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SUNDAY, MeetupSchedule.FIRST))
}
@Test
fun testFirstSundayOfApril2013() {
val expected = LocalDate.of(2013, 4, 7)
val meetup = Meetup(4, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SUNDAY, MeetupSchedule.FIRST))
}
@Test
fun testSecondMondayOfMarch2013() {
val expected = LocalDate.of(2013, 3, 11)
val meetup = Meetup(3, 2013)
assertEquals(expected, meetup.day(DayOfWeek.MONDAY, MeetupSchedule.SECOND))
}
@Test
fun testSecondMondayOfApril2013() {
val expected = LocalDate.of(2013, 4, 8)
val meetup = Meetup(4, 2013)
assertEquals(expected, meetup.day(DayOfWeek.MONDAY, MeetupSchedule.SECOND))
}
@Test
fun testSecondTuesdayOfMay2013() {
val expected = LocalDate.of(2013, 5, 14)
val meetup = Meetup(5, 2013)
assertEquals(expected, meetup.day(DayOfWeek.TUESDAY, MeetupSchedule.SECOND))
}
@Test
fun testSecondTuesdayOfJune2013() {
val expected = LocalDate.of(2013, 6, 11)
val meetup = Meetup(6, 2013)
assertEquals(expected, meetup.day(DayOfWeek.TUESDAY, MeetupSchedule.SECOND))
}
@Test
fun testSecondWednesdayOfJuly2013() {
val expected = LocalDate.of(2013, 7, 10)
val meetup = Meetup(7, 2013)
assertEquals(expected, meetup.day(DayOfWeek.WEDNESDAY, MeetupSchedule.SECOND))
}
@Test
fun testSecondWednesdayOfAugust2013() {
val expected = LocalDate.of(2013, 8, 14)
val meetup = Meetup(8, 2013)
assertEquals(expected, meetup.day(DayOfWeek.WEDNESDAY, MeetupSchedule.SECOND))
}
@Test
fun testSecondThursdayOfSeptember2013() {
val expected = LocalDate.of(2013, 9, 12)
val meetup = Meetup(9, 2013)
assertEquals(expected, meetup.day(DayOfWeek.THURSDAY, MeetupSchedule.SECOND))
}
@Test
fun testSecondThursdayOfOctober2013() {
val expected = LocalDate.of(2013, 10, 10)
val meetup = Meetup(10, 2013)
assertEquals(expected, meetup.day(DayOfWeek.THURSDAY, MeetupSchedule.SECOND))
}
@Test
fun testSecondFridayOfNovember2013() {
val expected = LocalDate.of(2013, 11, 8)
val meetup = Meetup(11, 2013)
assertEquals(expected, meetup.day(DayOfWeek.FRIDAY, MeetupSchedule.SECOND))
}
@Test
fun testSecondFridayOfDecember2013() {
val expected = LocalDate.of(2013, 12, 13)
val meetup = Meetup(12, 2013)
assertEquals(expected, meetup.day(DayOfWeek.FRIDAY, MeetupSchedule.SECOND))
}
@Test
fun testSecondSaturdayOfJanuary2013() {
val expected = LocalDate.of(2013, 1, 12)
val meetup = Meetup(1, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SATURDAY, MeetupSchedule.SECOND))
}
@Test
fun testSecondSaturdayOfFebruary2013() {
val expected = LocalDate.of(2013, 2, 9)
val meetup = Meetup(2, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SATURDAY, MeetupSchedule.SECOND))
}
@Test
fun testSecondSundayOfMarch2013() {
val expected = LocalDate.of(2013, 3, 10)
val meetup = Meetup(3, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SUNDAY, MeetupSchedule.SECOND))
}
@Test
fun testSecondSundayOfApril2013() {
val expected = LocalDate.of(2013, 4, 14)
val meetup = Meetup(4, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SUNDAY, MeetupSchedule.SECOND))
}
@Test
fun testThirdMondayOfMarch2013() {
val expected = LocalDate.of(2013, 3, 18)
val meetup = Meetup(3, 2013)
assertEquals(expected, meetup.day(DayOfWeek.MONDAY, MeetupSchedule.THIRD))
}
@Test
fun testThirdMondayOfApril2013() {
val expected = LocalDate.of(2013, 4, 15)
val meetup = Meetup(4, 2013)
assertEquals(expected, meetup.day(DayOfWeek.MONDAY, MeetupSchedule.THIRD))
}
@Test
fun testThirdTuesdayOfMay2013() {
val expected = LocalDate.of(2013, 5, 21)
val meetup = Meetup(5, 2013)
assertEquals(expected, meetup.day(DayOfWeek.TUESDAY, MeetupSchedule.THIRD))
}
@Test
fun testThirdTuesdayOfJune2013() {
val expected = LocalDate.of(2013, 6, 18)
val meetup = Meetup(6, 2013)
assertEquals(expected, meetup.day(DayOfWeek.TUESDAY, MeetupSchedule.THIRD))
}
@Test
fun testThirdWednesdayOfJuly2013() {
val expected = LocalDate.of(2013, 7, 17)
val meetup = Meetup(7, 2013)
assertEquals(expected, meetup.day(DayOfWeek.WEDNESDAY, MeetupSchedule.THIRD))
}
@Test
fun testThirdWednesdayOfAugust2013() {
val expected = LocalDate.of(2013, 8, 21)
val meetup = Meetup(8, 2013)
assertEquals(expected, meetup.day(DayOfWeek.WEDNESDAY, MeetupSchedule.THIRD))
}
@Test
fun testThirdThursdayOfSeptember2013() {
val expected = LocalDate.of(2013, 9, 19)
val meetup = Meetup(9, 2013)
assertEquals(expected, meetup.day(DayOfWeek.THURSDAY, MeetupSchedule.THIRD))
}
@Test
fun testThirdThursdayOfOctober2013() {
val expected = LocalDate.of(2013, 10, 17)
val meetup = Meetup(10, 2013)
assertEquals(expected, meetup.day(DayOfWeek.THURSDAY, MeetupSchedule.THIRD))
}
@Test
fun testThirdFridayOfNovember2013() {
val expected = LocalDate.of(2013, 11, 15)
val meetup = Meetup(11, 2013)
assertEquals(expected, meetup.day(DayOfWeek.FRIDAY, MeetupSchedule.THIRD))
}
@Test
fun testThirdFridayOfDecember2013() {
val expected = LocalDate.of(2013, 12, 20)
val meetup = Meetup(12, 2013)
assertEquals(expected, meetup.day(DayOfWeek.FRIDAY, MeetupSchedule.THIRD))
}
@Test
fun testThirdSaturdayOfJanuary2013() {
val expected = LocalDate.of(2013, 1, 19)
val meetup = Meetup(1, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SATURDAY, MeetupSchedule.THIRD))
}
@Test
fun testThirdSaturdayOfFebruary2013() {
val expected = LocalDate.of(2013, 2, 16)
val meetup = Meetup(2, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SATURDAY, MeetupSchedule.THIRD))
}
@Test
fun testThirdSundayOfMarch2013() {
val expected = LocalDate.of(2013, 3, 17)
val meetup = Meetup(3, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SUNDAY, MeetupSchedule.THIRD))
}
@Test
fun testThirdSundayOfApril2013() {
val expected = LocalDate.of(2013, 4, 21)
val meetup = Meetup(4, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SUNDAY, MeetupSchedule.THIRD))
}
@Test
fun testFourthMondayOfMarch2013() {
val expected = LocalDate.of(2013, 3, 25)
val meetup = Meetup(3, 2013)
assertEquals(expected, meetup.day(DayOfWeek.MONDAY, MeetupSchedule.FOURTH))
}
@Test
fun testFourthMondayOfApril2013() {
val expected = LocalDate.of(2013, 4, 22)
val meetup = Meetup(4, 2013)
assertEquals(expected, meetup.day(DayOfWeek.MONDAY, MeetupSchedule.FOURTH))
}
@Test
fun testFourthTuesdayOfMay2013() {
val expected = LocalDate.of(2013, 5, 28)
val meetup = Meetup(5, 2013)
assertEquals(expected, meetup.day(DayOfWeek.TUESDAY, MeetupSchedule.FOURTH))
}
@Test
fun testFourthTuesdayOfJune2013() {
val expected = LocalDate.of(2013, 6, 25)
val meetup = Meetup(6, 2013)
assertEquals(expected, meetup.day(DayOfWeek.TUESDAY, MeetupSchedule.FOURTH))
}
@Test
fun testFourthWednesdayOfJuly2013() {
val expected = LocalDate.of(2013, 7, 24)
val meetup = Meetup(7, 2013)
assertEquals(expected, meetup.day(DayOfWeek.WEDNESDAY, MeetupSchedule.FOURTH))
}
@Test
fun testFourthWednesdayOfAugust2013() {
val expected = LocalDate.of(2013, 8, 28)
val meetup = Meetup(8, 2013)
assertEquals(expected, meetup.day(DayOfWeek.WEDNESDAY, MeetupSchedule.FOURTH))
}
@Test
fun testFourthThursdayOfSeptember2013() {
val expected = LocalDate.of(2013, 9, 26)
val meetup = Meetup(9, 2013)
assertEquals(expected, meetup.day(DayOfWeek.THURSDAY, MeetupSchedule.FOURTH))
}
@Test
fun testFourthThursdayOfOctober2013() {
val expected = LocalDate.of(2013, 10, 24)
val meetup = Meetup(10, 2013)
assertEquals(expected, meetup.day(DayOfWeek.THURSDAY, MeetupSchedule.FOURTH))
}
@Test
fun testFourthFridayOfNovember2013() {
val expected = LocalDate.of(2013, 11, 22)
val meetup = Meetup(11, 2013)
assertEquals(expected, meetup.day(DayOfWeek.FRIDAY, MeetupSchedule.FOURTH))
}
@Test
fun testFourthFridayOfDecember2013() {
val expected = LocalDate.of(2013, 12, 27)
val meetup = Meetup(12, 2013)
assertEquals(expected, meetup.day(DayOfWeek.FRIDAY, MeetupSchedule.FOURTH))
}
@Test
fun testFourthSaturdayOfJanuary2013() {
val expected = LocalDate.of(2013, 1, 26)
val meetup = Meetup(1, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SATURDAY, MeetupSchedule.FOURTH))
}
@Test
fun testFourthSaturdayOfFebruary2013() {
val expected = LocalDate.of(2013, 2, 23)
val meetup = Meetup(2, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SATURDAY, MeetupSchedule.FOURTH))
}
@Test
fun testFourthSundayOfMarch2013() {
val expected = LocalDate.of(2013, 3, 24)
val meetup = Meetup(3, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SUNDAY, MeetupSchedule.FOURTH))
}
@Test
fun testFourthSundayOfApril2013() {
val expected = LocalDate.of(2013, 4, 28)
val meetup = Meetup(4, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SUNDAY, MeetupSchedule.FOURTH))
}
@Test
fun testLastMondayOfMarch2013() {
val expected = LocalDate.of(2013, 3, 25)
val meetup = Meetup(3, 2013)
assertEquals(expected, meetup.day(DayOfWeek.MONDAY, MeetupSchedule.LAST))
}
@Test
fun testLastMondayOfApril2013() {
val expected = LocalDate.of(2013, 4, 29)
val meetup = Meetup(4, 2013)
assertEquals(expected, meetup.day(DayOfWeek.MONDAY, MeetupSchedule.LAST))
}
@Test
fun testLastTuesdayOfMay2013() {
val expected = LocalDate.of(2013, 5, 28)
val meetup = Meetup(5, 2013)
assertEquals(expected, meetup.day(DayOfWeek.TUESDAY, MeetupSchedule.LAST))
}
@Test
fun testLastTuesdayOfJune2013() {
val expected = LocalDate.of(2013, 6, 25)
val meetup = Meetup(6, 2013)
assertEquals(expected, meetup.day(DayOfWeek.TUESDAY, MeetupSchedule.LAST))
}
@Test
fun testLastWednesdayOfJuly2013() {
val expected = LocalDate.of(2013, 7, 31)
val meetup = Meetup(7, 2013)
assertEquals(expected, meetup.day(DayOfWeek.WEDNESDAY, MeetupSchedule.LAST))
}
@Test
fun testLastWednesdayOfAugust2013() {
val expected = LocalDate.of(2013, 8, 28)
val meetup = Meetup(8, 2013)
assertEquals(expected, meetup.day(DayOfWeek.WEDNESDAY, MeetupSchedule.LAST))
}
@Test
fun testLastThursdayOfSeptember2013() {
val expected = LocalDate.of(2013, 9, 26)
val meetup = Meetup(9, 2013)
assertEquals(expected, meetup.day(DayOfWeek.THURSDAY, MeetupSchedule.LAST))
}
@Test
fun testLastThursdayOfOctober2013() {
val expected = LocalDate.of(2013, 10, 31)
val meetup = Meetup(10, 2013)
assertEquals(expected, meetup.day(DayOfWeek.THURSDAY, MeetupSchedule.LAST))
}
@Test
fun testLastFridayOfNovember2013() {
val expected = LocalDate.of(2013, 11, 29)
val meetup = Meetup(11, 2013)
assertEquals(expected, meetup.day(DayOfWeek.FRIDAY, MeetupSchedule.LAST))
}
@Test
fun testLastFridayOfDecember2013() {
val expected = LocalDate.of(2013, 12, 27)
val meetup = Meetup(12, 2013)
assertEquals(expected, meetup.day(DayOfWeek.FRIDAY, MeetupSchedule.LAST))
}
@Test
fun testLastSaturdayOfJanuary2013() {
val expected = LocalDate.of(2013, 1, 26)
val meetup = Meetup(1, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SATURDAY, MeetupSchedule.LAST))
}
@Test
fun testLastSaturdayOfFebruary2013() {
val expected = LocalDate.of(2013, 2, 23)
val meetup = Meetup(2, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SATURDAY, MeetupSchedule.LAST))
}
@Test
fun testLastSundayOfMarch2013() {
val expected = LocalDate.of(2013, 3, 31)
val meetup = Meetup(3, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SUNDAY, MeetupSchedule.LAST))
}
@Test
fun testLastSundayOfApril2013() {
val expected = LocalDate.of(2013, 4, 28)
val meetup = Meetup(4, 2013)
assertEquals(expected, meetup.day(DayOfWeek.SUNDAY, MeetupSchedule.LAST))
}
@Test
fun testLastWednesdayOfFebruary2012() {
val expected = LocalDate.of(2012, 2, 29)
val meetup = Meetup(2, 2012)
assertEquals(expected, meetup.day(DayOfWeek.WEDNESDAY, MeetupSchedule.LAST))
}
@Test
fun testLastWednesdayOfDecember2014() {
val expected = LocalDate.of(2014, 12, 31)
val meetup = Meetup(12, 2014)
assertEquals(expected, meetup.day(DayOfWeek.WEDNESDAY, MeetupSchedule.LAST))
}
@Test
fun testLastSundayOfFebruary2015() {
val expected = LocalDate.of(2015, 2, 22)
val meetup = Meetup(2, 2015)
assertEquals(expected, meetup.day(DayOfWeek.SUNDAY, MeetupSchedule.LAST))
}
@Test
fun testFirstFridayOfDecember2012() {
val expected = LocalDate.of(2012, 12, 7)
val meetup = Meetup(12, 2012)
assertEquals(expected, meetup.day(DayOfWeek.FRIDAY, MeetupSchedule.FIRST))
}
}