package com.pkrharrison.utils;

import static org.junit.Assert.*;

import org.junit.Test; 

public class CombinationsTest {

	
	@Test
	public void testCount() {		
		for (int N = 0; N <= 10; N++ ) {
			for (int k = 0; k <= 7; k++) {
				if (k > N) {
					assertEquals(0, Combinations.count(N, k));
				} else {
					assertEquals(fact(N) / (fact(N-k) * fact(k)), Combinations.count(N, k)); 
				}				
			}
		}
		
	}
	
	private int fact(int n) {
		if (n == 0) return 1; 
		return n*fact(n-1);
	}
}
