Skip to content

Instantly share code, notes, and snippets.

View MikeMKH's full-sized avatar
:shipit:
Learning about logic programming with Prolog

Mike Harris MikeMKH

:shipit:
Learning about logic programming with Prolog
  • Milwaukee, WI
  • 21:47 (UTC -05:00)
View GitHub Profile
@MikeMKH
MikeMKH / NunitCharacterizationTestsUsingFizzBuzz.cs
Created May 30, 2014 11:55
FizzBuzz kata used to look into what can be done with Nunit.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using NUnit.Framework.Constraints;
namespace NUnit
@MikeMKH
MikeMKH / leap_year.hs
Created June 1, 2014 21:31
Leap year check kata in Haskell using HUnit
import Test.HUnit
isLeapYear::Int->Bool
isLeapYear y
| mod y 400 == 0 = True
| mod y 100 == 0 = False
| mod y 4 == 0 = True
| otherwise = False
tests = TestList[TestCase $ assertEqual "4 is a leap year" True $ isLeapYear 4
@MikeMKH
MikeMKH / LeapYearChecker.cs
Created June 2, 2014 11:59
Leap year check kata in C# using NUnit
using NUnit.Framework;
namespace LeapYear
{
public class LeapYearChecker
{
public bool IsLeapYear(int year)
{
if (year % 400 == 0) return true;
if (year % 100 == 0) return false;
@MikeMKH
MikeMKH / LeapYear.scala
Last active August 29, 2015 14:02
Leap year kata in Scala using ScalaTest
package com.bigcompany.utils.test
import org.scalatest._
object LeapYear {
def isLeapYear(year: Int) = (year % 4, year % 100, year % 400) match {
case (_, _, 0) => true
case (_, 0, _) => false
case (0, _, _) => true
case _ => false
@MikeMKH
MikeMKH / LeapYearChecker.fs
Created June 6, 2014 11:57
Leap year kata in F# using FsUnit with Xunit
namespace LeapYearChecker
open Xunit
open FsUnit.Xunit
module ``leap year kata`` =
let (|DivisibleBy|_|) by x = if x % by = 0 then Some DivisibleBy else None
let isLeapYear (year) =
@MikeMKH
MikeMKH / FizzBuzz.feature
Created June 12, 2014 12:06
FizzBuzz kata in C# using SpecFlow with NUnit
Feature: FizzBuzz
As a Software Craftsman
I want to do the FizzBuzz kata
So that I can get better at my craft
Scenario Outline: Validate the functionality of FizzBuzz using the following
Given the follow input <value>
When FizzBuzz is invoked with the input <value>
Then the actual result will equal the <expected>
@MikeMKH
MikeMKH / FizzBuzzSpec2.scala
Created June 13, 2014 12:00
FizzBuzz kata in Scala using Specs2
package com.kata.spec2
import org.specs2._
import matcher.DataTables
object FizzBuzzer {
class FizzBuzzExtractor[T](f: T => Boolean) {
def unapply(x: T) = f(x)
}
@MikeMKH
MikeMKH / FizzBuzzProperties.cs
Last active August 29, 2015 14:02
FizzBuzz kata using C# with SpecFlow and FsCheck using NUnit
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using FsCheck;
using NUnit.Framework;
using FsCheck.Fluent;
@MikeMKH
MikeMKH / FizzBuzzer.cs
Created June 29, 2014 14:17
Proving FizzBuzz traits in C# using SpecFlow with NUnit.
namespace FizzBuzz
{
public class FizzBuzzer
{
public string Translate(int value)
{
var result = string.Empty;
if (value % 3 == 0) result += "Fizz";
if (value % 5 == 0) result += "Buzz";
@MikeMKH
MikeMKH / FizzBuzzPropertyTests.cs
Created July 3, 2014 11:42
FizzBuzz kata using C# with NUnit and FsCheck
using System.Text.RegularExpressions;
using FsCheck;
using FsCheck.Fluent;
using NUnit.Framework;
namespace FizzBuzz
{
public class FizzBuzzer
{
public string Translate(int value)