package com.geth1b.coding.skills.lc;

import com.geth1b.coding.ds.Interval;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;

/**
 * @author geth1b
 */
public class _252_MeetingRooms_Test {
  private _252_MeetingRooms solution;
  
  @Before public void setUp() {
    solution = new _252_MeetingRooms();
  }
  
  @Test public void canAttendMeetings_false() {
    Interval[] intervals = new Interval[]{
      new Interval(0,30),
      new Interval(5,10),
      new Interval(15,20)
    };
    assertFalse(solution.canAttendMeetings(intervals));
  }
  
  @Test public void canAttendMeetings_true() {
    Interval[] intervals = new Interval[]{
      new Interval(0,4),
      new Interval(5,10),
      new Interval(15,20)
    };
    assertTrue(solution.canAttendMeetings(intervals));
  } 
  
  @Test public void canAttendMeetings_failedCase1() {
    // consecutive meetings should be fine
    Interval[] intervals = new Interval[]{
      new Interval(13,15),
      new Interval(1,13)
    };
    assertTrue(solution.canAttendMeetings(intervals));
  } 
  
  @Test public void canAttendMeetings_failedCase2() {
    Interval[] intervals = new Interval[]{};
    assertTrue(solution.canAttendMeetings(intervals));
  }   
}
