meetup: initial commit

This commit is contained in:
Dmitry Kokorin 2016-04-13 23:43:53 +03:00
parent f77d5a95e7
commit 44185bf4f7
3 changed files with 840 additions and 0 deletions

59
cpp/meetup/CMakeLists.txt Normal file
View file

@ -0,0 +1,59 @@
# Get the exercise name from the current directory
get_filename_component(exercise ${CMAKE_CURRENT_SOURCE_DIR} NAME)
# Basic CMake project
cmake_minimum_required(VERSION 2.8.11)
# Name the project after the exercise
project(${exercise} CXX)
# Locate Boost libraries: unit_test_framework, date_time and regex
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.55 REQUIRED COMPONENTS unit_test_framework date_time regex)
# Enable C++11 features on gcc/clang
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)")
set(CMAKE_CXX_FLAGS "-std=c++11")
endif()
# Configure to run all the tests?
if(${EXERCISM_RUN_ALL_TESTS})
add_definitions(-DEXERCISM_RUN_ALL_TESTS)
endif()
# Get a source filename from the exercise name by replacing -'s with _'s
string(REPLACE "-" "_" file ${exercise})
# Implementation could be only a header
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.cpp)
set(exercise_cpp ${file}.cpp)
else()
set(exercise_cpp "")
endif()
# Include a test helper header if it exists
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/require_equal_containers.h)
set(test_helper require_equal_containers.h)
else()
set(test_helper "")
endif()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${test_helper} ${exercise_cpp} ${file}.h)
# We need boost includes
target_include_directories(${exercise} PRIVATE ${Boost_INCLUDE_DIRS})
# We need boost libraries
target_link_libraries(${exercise} ${Boost_LIBRARIES})
# Tell MSVC not to warn us about unchecked iterators in debug builds
if(${MSVC})
set_target_properties(${exercise} PROPERTIES
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS)
endif()
# Run the tests on every build
add_custom_command(TARGET ${exercise} POST_BUILD COMMAND ${exercise})

53
cpp/meetup/README.md Normal file
View file

@ -0,0 +1,53 @@
# Meetup
Calculate the date of meetups.
Typically meetups happen on the same day of the week.
Examples are
- the first Monday
- the third Tuesday
- the Wednesteenth
- the last Thursday
Note that "Monteenth", "Tuesteenth", etc are all made up words. There
was a meetup whose members realised that there are exactly 7 days 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.
## Getting Started
Make sure you have read [the C++ page](http://exercism.io/languages/cpp) on
exercism.io. This covers the basic information on setting up the development
environment expected by the exercises.
## Passing the Tests
Get the first test compiling, linking and passing by following the [three
rules of test-driven development](http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd).
Create just enough structure by declaring namespaces, functions, classes,
etc., to satisfy any compiler errors and get the test to fail. Then write
just enough code to get the test to pass. Once you've done that,
uncomment the next test by moving the following line past the next test.
```C++
#if defined(EXERCISM_RUN_ALL_TESTS)
```
This may result in compile errors as new constructs may be invoked that
you haven't yet declared or defined. Again, fix the compile errors minimally
to get a failing test, then change the code minimally to pass the test,
refactor your implementation for readability and expressiveness and then
go on to the next test.
Try to use standard C++11 facilities in preference to writing your own
low-level algorithms or facilities by hand. [CppReference](http://en.cppreference.com/)
is a wiki reference to the C++ language and standard library. If you
are new to C++, but have programmed in C, beware of
[C traps and pitfalls](http://www.slideshare.net/LegalizeAdulthood/c-traps-and-pitfalls-for-c-programmers).
## Source
Jeremy Hinegardner mentioned a Boulder meetup that happens on the Wednesteenth of every month [view source](https://twitter.com/copiousfreetime)

728
cpp/meetup/meetup_test.cpp Normal file
View file

@ -0,0 +1,728 @@
#include "meetup.h"
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
// See <http://www.boost.org/doc/libs/1_55_0/doc/html/date_time.html>
// for documentation on boost::gregorian::date
BOOST_AUTO_TEST_CASE(monteenth_of_May_2013)
{
const meetup::scheduler meetup{boost::gregorian::May, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::May, 13};
BOOST_REQUIRE_EQUAL(expected, meetup.monteenth());
}
#if defined(EXERCISM_RUN_ALL_TESTS)
BOOST_AUTO_TEST_CASE(monteenth_of_August_2013)
{
const meetup::scheduler meetup{boost::gregorian::Aug, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Aug, 19};
BOOST_REQUIRE_EQUAL(expected, meetup.monteenth());
}
BOOST_AUTO_TEST_CASE(monteenth_of_September_2013)
{
const meetup::scheduler meetup{boost::gregorian::Sep, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Sep, 16};
BOOST_REQUIRE_EQUAL(expected, meetup.monteenth());
}
BOOST_AUTO_TEST_CASE(tuesteenth_of_March_2013)
{
const meetup::scheduler meetup{boost::gregorian::Mar, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Mar, 19};
BOOST_REQUIRE_EQUAL(expected, meetup.tuesteenth());
}
BOOST_AUTO_TEST_CASE(tuesteenth_of_April_2013)
{
const meetup::scheduler meetup{boost::gregorian::Apr, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Apr, 16};
BOOST_REQUIRE_EQUAL(expected, meetup.tuesteenth());
}
BOOST_AUTO_TEST_CASE(tuesteenth_of_August_2013)
{
const meetup::scheduler meetup{boost::gregorian::Aug, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Aug, 13};
BOOST_REQUIRE_EQUAL(expected, meetup.tuesteenth());
}
BOOST_AUTO_TEST_CASE(wednesteenth_of_January_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jan, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jan, 16};
BOOST_REQUIRE_EQUAL(expected, meetup.wednesteenth());
}
BOOST_AUTO_TEST_CASE(wednesteenth_of_February_2013)
{
const meetup::scheduler meetup{boost::gregorian::Feb, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Feb, 13};
BOOST_REQUIRE_EQUAL(expected, meetup.wednesteenth());
}
BOOST_AUTO_TEST_CASE(wednesteenth_of_June_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jun, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jun, 19};
BOOST_REQUIRE_EQUAL(expected, meetup.wednesteenth());
}
BOOST_AUTO_TEST_CASE(thursteenth_of_May_2013)
{
const meetup::scheduler meetup{boost::gregorian::May, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::May, 16};
BOOST_REQUIRE_EQUAL(expected, meetup.thursteenth());
}
BOOST_AUTO_TEST_CASE(thursteenth_of_June_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jun, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jun, 13};
BOOST_REQUIRE_EQUAL(expected, meetup.thursteenth());
}
BOOST_AUTO_TEST_CASE(thursteenth_of_September_2013)
{
const meetup::scheduler meetup{boost::gregorian::Sep, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Sep, 19};
BOOST_REQUIRE_EQUAL(expected, meetup.thursteenth());
}
BOOST_AUTO_TEST_CASE(friteenth_of_April_2013)
{
const meetup::scheduler meetup{boost::gregorian::Apr, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Apr, 19};
BOOST_REQUIRE_EQUAL(expected, meetup.friteenth());
}
BOOST_AUTO_TEST_CASE(friteenth_of_Aug_2013)
{
const meetup::scheduler meetup{boost::gregorian::Aug, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Aug, 16};
BOOST_REQUIRE_EQUAL(expected, meetup.friteenth());
}
BOOST_AUTO_TEST_CASE(friteenth_of_September_2013)
{
const meetup::scheduler meetup{boost::gregorian::Sep, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Sep, 13};
BOOST_REQUIRE_EQUAL(expected, meetup.friteenth());
}
BOOST_AUTO_TEST_CASE(saturteenth_of_February_2013)
{
const meetup::scheduler meetup{boost::gregorian::Feb, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Feb, 16};
BOOST_REQUIRE_EQUAL(expected, meetup.saturteenth());
}
BOOST_AUTO_TEST_CASE(saturteenth_of_October_2013)
{
const meetup::scheduler meetup{boost::gregorian::Oct, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Oct, 19};
BOOST_REQUIRE_EQUAL(expected, meetup.saturteenth());
}
BOOST_AUTO_TEST_CASE(sunteenth_of_May_2013)
{
const meetup::scheduler meetup{boost::gregorian::May, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::May, 19};
BOOST_REQUIRE_EQUAL(expected, meetup.sunteenth());
}
BOOST_AUTO_TEST_CASE(sunteenth_of_June_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jun, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jun, 16};
BOOST_REQUIRE_EQUAL(expected, meetup.sunteenth());
}
BOOST_AUTO_TEST_CASE(sunteenth_of_October_2013)
{
const meetup::scheduler meetup{boost::gregorian::Oct, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Oct, 13};
BOOST_REQUIRE_EQUAL(expected, meetup.sunteenth());
}
BOOST_AUTO_TEST_CASE(first_Monday_of_March_2013)
{
const meetup::scheduler meetup{boost::gregorian::Mar, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Mar, 4};
BOOST_REQUIRE_EQUAL(expected, meetup.first_monday());
}
BOOST_AUTO_TEST_CASE(first_Monday_of_April_2013)
{
const meetup::scheduler meetup{boost::gregorian::Apr, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Apr, 1};
BOOST_REQUIRE_EQUAL(expected, meetup.first_monday());
}
BOOST_AUTO_TEST_CASE(first_Tuesday_of_May_2013)
{
const meetup::scheduler meetup{boost::gregorian::May, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::May, 7};
BOOST_REQUIRE_EQUAL(expected, meetup.first_tuesday());
}
BOOST_AUTO_TEST_CASE(first_Tuesday_of_June_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jun, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jun, 4};
BOOST_REQUIRE_EQUAL(expected, meetup.first_tuesday());
}
BOOST_AUTO_TEST_CASE(first_Wednesday_of_July_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jul, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jul, 3};
BOOST_REQUIRE_EQUAL(expected, meetup.first_wednesday());
}
BOOST_AUTO_TEST_CASE(first_Wednesday_of_August_2013)
{
const meetup::scheduler meetup{boost::gregorian::Aug, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Aug, 7};
BOOST_REQUIRE_EQUAL(expected, meetup.first_wednesday());
}
BOOST_AUTO_TEST_CASE(first_Thursday_of_September_2013)
{
const meetup::scheduler meetup{boost::gregorian::Sep, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Sep, 5};
BOOST_REQUIRE_EQUAL(expected, meetup.first_thursday());
}
BOOST_AUTO_TEST_CASE(first_Thursday_of_October_2013)
{
const meetup::scheduler meetup{boost::gregorian::Oct, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Oct, 3};
BOOST_REQUIRE_EQUAL(expected, meetup.first_thursday());
}
BOOST_AUTO_TEST_CASE(first_Friday_of_November_2013)
{
const meetup::scheduler meetup{boost::gregorian::Nov, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Nov, 1};
BOOST_REQUIRE_EQUAL(expected, meetup.first_friday());
}
BOOST_AUTO_TEST_CASE(first_Friday_of_December_2013)
{
const meetup::scheduler meetup{boost::gregorian::Dec, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Dec, 6};
BOOST_REQUIRE_EQUAL(expected, meetup.first_friday());
}
BOOST_AUTO_TEST_CASE(first_Saturday_of_January_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jan, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jan, 5};
BOOST_REQUIRE_EQUAL(expected, meetup.first_saturday());
}
BOOST_AUTO_TEST_CASE(first_Saturday_of_February_2013)
{
const meetup::scheduler meetup{boost::gregorian::Feb, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Feb, 2};
BOOST_REQUIRE_EQUAL(expected, meetup.first_saturday());
}
BOOST_AUTO_TEST_CASE(first_Sunday_of_March_2013)
{
const meetup::scheduler meetup{boost::gregorian::Mar, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Mar, 3};
BOOST_REQUIRE_EQUAL(expected, meetup.first_sunday());
}
BOOST_AUTO_TEST_CASE(first_Sunday_of_April_2013)
{
const meetup::scheduler meetup{boost::gregorian::Apr, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Apr, 7};
BOOST_REQUIRE_EQUAL(expected, meetup.first_sunday());
}
BOOST_AUTO_TEST_CASE(second_Monday_of_March_2013)
{
const meetup::scheduler meetup{boost::gregorian::Mar, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Mar, 11};
BOOST_REQUIRE_EQUAL(expected, meetup.second_monday());
}
BOOST_AUTO_TEST_CASE(second_Monday_of_April_2013)
{
const meetup::scheduler meetup{boost::gregorian::Apr, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Apr, 8};
BOOST_REQUIRE_EQUAL(expected, meetup.second_monday());
}
BOOST_AUTO_TEST_CASE(second_Tuesday_of_May_2013)
{
const meetup::scheduler meetup{boost::gregorian::May, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::May, 14};
BOOST_REQUIRE_EQUAL(expected, meetup.second_tuesday());
}
BOOST_AUTO_TEST_CASE(second_Tuesday_of_June_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jun, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jun, 11};
BOOST_REQUIRE_EQUAL(expected, meetup.second_tuesday());
}
BOOST_AUTO_TEST_CASE(second_Wednesday_of_July_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jul, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jul, 10};
BOOST_REQUIRE_EQUAL(expected, meetup.second_wednesday());
}
BOOST_AUTO_TEST_CASE(second_Wednesday_of_August_2013)
{
const meetup::scheduler meetup{boost::gregorian::Aug, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Aug, 14};
BOOST_REQUIRE_EQUAL(expected, meetup.second_wednesday());
}
BOOST_AUTO_TEST_CASE(second_Thursday_of_September_2013)
{
const meetup::scheduler meetup{boost::gregorian::Sep, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Sep, 12};
BOOST_REQUIRE_EQUAL(expected, meetup.second_thursday());
}
BOOST_AUTO_TEST_CASE(second_Thursday_of_October_2013)
{
const meetup::scheduler meetup{boost::gregorian::Oct, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Oct, 10};
BOOST_REQUIRE_EQUAL(expected, meetup.second_thursday());
}
BOOST_AUTO_TEST_CASE(second_Friday_of_November_2013)
{
const meetup::scheduler meetup{boost::gregorian::Nov, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Nov, 8};
BOOST_REQUIRE_EQUAL(expected, meetup.second_friday());
}
BOOST_AUTO_TEST_CASE(second_Friday_of_December_2013)
{
const meetup::scheduler meetup{boost::gregorian::Dec, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Dec, 13};
BOOST_REQUIRE_EQUAL(expected, meetup.second_friday());
}
BOOST_AUTO_TEST_CASE(second_Saturday_of_January_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jan, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jan, 12};
BOOST_REQUIRE_EQUAL(expected, meetup.second_saturday());
}
BOOST_AUTO_TEST_CASE(second_Saturday_of_February_2013)
{
const meetup::scheduler meetup{boost::gregorian::Feb, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Feb, 9};
BOOST_REQUIRE_EQUAL(expected, meetup.second_saturday());
}
BOOST_AUTO_TEST_CASE(second_Sunday_of_March_2013)
{
const meetup::scheduler meetup{boost::gregorian::Mar, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Mar, 10};
BOOST_REQUIRE_EQUAL(expected, meetup.second_sunday());
}
BOOST_AUTO_TEST_CASE(second_Sunday_of_April_2013)
{
const meetup::scheduler meetup{boost::gregorian::Apr, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Apr, 14};
BOOST_REQUIRE_EQUAL(expected, meetup.second_sunday());
}
BOOST_AUTO_TEST_CASE(third_Monday_of_March_2013)
{
const meetup::scheduler meetup{boost::gregorian::Mar, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Mar, 18};
BOOST_REQUIRE_EQUAL(expected, meetup.third_monday());
}
BOOST_AUTO_TEST_CASE(third_Monday_of_April_2013)
{
const meetup::scheduler meetup{boost::gregorian::Apr, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Apr, 15};
BOOST_REQUIRE_EQUAL(expected, meetup.third_monday());
}
BOOST_AUTO_TEST_CASE(third_Tuesday_of_May_2013)
{
const meetup::scheduler meetup{boost::gregorian::May, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::May, 21};
BOOST_REQUIRE_EQUAL(expected, meetup.third_tuesday());
}
BOOST_AUTO_TEST_CASE(third_Tuesday_of_June_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jun, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jun, 18};
BOOST_REQUIRE_EQUAL(expected, meetup.third_tuesday());
}
BOOST_AUTO_TEST_CASE(third_Wednesday_of_July_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jul, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jul, 17};
BOOST_REQUIRE_EQUAL(expected, meetup.third_wednesday());
}
BOOST_AUTO_TEST_CASE(third_Wednesday_of_August_2013)
{
const meetup::scheduler meetup{boost::gregorian::Aug, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Aug, 21};
BOOST_REQUIRE_EQUAL(expected, meetup.third_wednesday());
}
BOOST_AUTO_TEST_CASE(third_Thursday_of_September_2013)
{
const meetup::scheduler meetup{boost::gregorian::Sep, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Sep, 19};
BOOST_REQUIRE_EQUAL(expected, meetup.third_thursday());
}
BOOST_AUTO_TEST_CASE(third_Thursday_of_October_2013)
{
const meetup::scheduler meetup{boost::gregorian::Oct, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Oct, 17};
BOOST_REQUIRE_EQUAL(expected, meetup.third_thursday());
}
BOOST_AUTO_TEST_CASE(third_Friday_of_November_2013)
{
const meetup::scheduler meetup{boost::gregorian::Nov, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Nov, 15};
BOOST_REQUIRE_EQUAL(expected, meetup.third_friday());
}
BOOST_AUTO_TEST_CASE(third_Friday_of_December_2013)
{
const meetup::scheduler meetup{boost::gregorian::Dec, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Dec, 20};
BOOST_REQUIRE_EQUAL(expected, meetup.third_friday());
}
BOOST_AUTO_TEST_CASE(third_Saturday_of_January_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jan, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jan, 19};
BOOST_REQUIRE_EQUAL(expected, meetup.third_saturday());
}
BOOST_AUTO_TEST_CASE(third_Saturday_of_February_2013)
{
const meetup::scheduler meetup{boost::gregorian::Feb, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Feb, 16};
BOOST_REQUIRE_EQUAL(expected, meetup.third_saturday());
}
BOOST_AUTO_TEST_CASE(third_Sunday_of_March_2013)
{
const meetup::scheduler meetup{boost::gregorian::Mar, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Mar, 17};
BOOST_REQUIRE_EQUAL(expected, meetup.third_sunday());
}
BOOST_AUTO_TEST_CASE(third_Sunday_of_April_2013)
{
const meetup::scheduler meetup{boost::gregorian::Apr, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Apr, 21};
BOOST_REQUIRE_EQUAL(expected, meetup.third_sunday());
}
BOOST_AUTO_TEST_CASE(fourth_Monday_of_March_2013)
{
const meetup::scheduler meetup{boost::gregorian::Mar, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Mar, 25};
BOOST_REQUIRE_EQUAL(expected, meetup.fourth_monday());
}
BOOST_AUTO_TEST_CASE(fourth_Monday_of_April_2013)
{
const meetup::scheduler meetup{boost::gregorian::Apr, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Apr, 22};
BOOST_REQUIRE_EQUAL(expected, meetup.fourth_monday());
}
BOOST_AUTO_TEST_CASE(fourth_Tuesday_of_May_2013)
{
const meetup::scheduler meetup{boost::gregorian::May, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::May, 28};
BOOST_REQUIRE_EQUAL(expected, meetup.fourth_tuesday());
}
BOOST_AUTO_TEST_CASE(fourth_Tuesday_of_June_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jun, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jun, 25};
BOOST_REQUIRE_EQUAL(expected, meetup.fourth_tuesday());
}
BOOST_AUTO_TEST_CASE(fourth_Wednesday_of_July_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jul, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jul, 24};
BOOST_REQUIRE_EQUAL(expected, meetup.fourth_wednesday());
}
BOOST_AUTO_TEST_CASE(fourth_Wednesday_of_August_2013)
{
const meetup::scheduler meetup{boost::gregorian::Aug, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Aug, 28};
BOOST_REQUIRE_EQUAL(expected, meetup.fourth_wednesday());
}
BOOST_AUTO_TEST_CASE(fourth_Thursday_of_September_2013)
{
const meetup::scheduler meetup{boost::gregorian::Sep, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Sep, 26};
BOOST_REQUIRE_EQUAL(expected, meetup.fourth_thursday());
}
BOOST_AUTO_TEST_CASE(fourth_Thursday_of_October_2013)
{
const meetup::scheduler meetup{boost::gregorian::Oct, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Oct, 24};
BOOST_REQUIRE_EQUAL(expected, meetup.fourth_thursday());
}
BOOST_AUTO_TEST_CASE(fourth_Friday_of_November_2013)
{
const meetup::scheduler meetup{boost::gregorian::Nov, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Nov, 22};
BOOST_REQUIRE_EQUAL(expected, meetup.fourth_friday());
}
BOOST_AUTO_TEST_CASE(fourth_Friday_of_December_2013)
{
const meetup::scheduler meetup{boost::gregorian::Dec, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Dec, 27};
BOOST_REQUIRE_EQUAL(expected, meetup.fourth_friday());
}
BOOST_AUTO_TEST_CASE(fourth_Saturday_of_January_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jan, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jan, 26};
BOOST_REQUIRE_EQUAL(expected, meetup.fourth_saturday());
}
BOOST_AUTO_TEST_CASE(fourth_Saturday_of_February_2013)
{
const meetup::scheduler meetup{boost::gregorian::Feb, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Feb, 23};
BOOST_REQUIRE_EQUAL(expected, meetup.fourth_saturday());
}
BOOST_AUTO_TEST_CASE(fourth_Sunday_of_March_2013)
{
const meetup::scheduler meetup{boost::gregorian::Mar, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Mar, 24};
BOOST_REQUIRE_EQUAL(expected, meetup.fourth_sunday());
}
BOOST_AUTO_TEST_CASE(fourth_Sunday_of_April_2013)
{
const meetup::scheduler meetup{boost::gregorian::Apr, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Apr, 28};
BOOST_REQUIRE_EQUAL(expected, meetup.fourth_sunday());
}
BOOST_AUTO_TEST_CASE(last_Monday_of_March_2013)
{
const meetup::scheduler meetup{boost::gregorian::Mar, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Mar, 25};
BOOST_REQUIRE_EQUAL(expected, meetup.last_monday());
}
BOOST_AUTO_TEST_CASE(last_Monday_of_April_2013)
{
const meetup::scheduler meetup{boost::gregorian::Apr, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Apr, 29};
BOOST_REQUIRE_EQUAL(expected, meetup.last_monday());
}
BOOST_AUTO_TEST_CASE(last_Tuesday_of_May_2013)
{
const meetup::scheduler meetup{boost::gregorian::May, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::May, 28};
BOOST_REQUIRE_EQUAL(expected, meetup.last_tuesday());
}
BOOST_AUTO_TEST_CASE(last_Tuesday_of_June_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jun, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jun, 25};
BOOST_REQUIRE_EQUAL(expected, meetup.last_tuesday());
}
BOOST_AUTO_TEST_CASE(last_Wednesday_of_July_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jul, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jul, 31};
BOOST_REQUIRE_EQUAL(expected, meetup.last_wednesday());
}
BOOST_AUTO_TEST_CASE(last_Wednesday_of_August_2013)
{
const meetup::scheduler meetup{boost::gregorian::Aug, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Aug, 28};
BOOST_REQUIRE_EQUAL(expected, meetup.last_wednesday());
}
BOOST_AUTO_TEST_CASE(last_Thursday_of_September_2013)
{
const meetup::scheduler meetup{boost::gregorian::Sep, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Sep, 26};
BOOST_REQUIRE_EQUAL(expected, meetup.last_thursday());
}
BOOST_AUTO_TEST_CASE(last_Thursday_of_October_2013)
{
const meetup::scheduler meetup{boost::gregorian::Oct, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Oct, 31};
BOOST_REQUIRE_EQUAL(expected, meetup.last_thursday());
}
BOOST_AUTO_TEST_CASE(last_Friday_of_November_2013)
{
const meetup::scheduler meetup{boost::gregorian::Nov, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Nov, 29};
BOOST_REQUIRE_EQUAL(expected, meetup.last_friday());
}
BOOST_AUTO_TEST_CASE(last_Friday_of_December_2013)
{
const meetup::scheduler meetup{boost::gregorian::Dec, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Dec, 27};
BOOST_REQUIRE_EQUAL(expected, meetup.last_friday());
}
BOOST_AUTO_TEST_CASE(last_Saturday_of_January_2013)
{
const meetup::scheduler meetup{boost::gregorian::Jan, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Jan, 26};
BOOST_REQUIRE_EQUAL(expected, meetup.last_saturday());
}
BOOST_AUTO_TEST_CASE(last_Saturday_of_February_2013)
{
const meetup::scheduler meetup{boost::gregorian::Feb, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Feb, 23};
BOOST_REQUIRE_EQUAL(expected, meetup.last_saturday());
}
BOOST_AUTO_TEST_CASE(last_Sunday_of_March_2013)
{
const meetup::scheduler meetup{boost::gregorian::Mar, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Mar, 31};
BOOST_REQUIRE_EQUAL(expected, meetup.last_sunday());
}
BOOST_AUTO_TEST_CASE(last_Sunday_of_April_2013)
{
const meetup::scheduler meetup{boost::gregorian::Apr, 2013};
const boost::gregorian::date expected{2013, boost::gregorian::Apr, 28};
BOOST_REQUIRE_EQUAL(expected, meetup.last_sunday());
}
#endif