package test.leecode.number;
import org.junit.Assert;
import org.junit.Test;
import cn.fansunion.leecode.number.ThirdMaximumNumber;
/**
* @author wen.lei@brgroup.com
*
* 2022-1-12
*/
public class ThirdMaximumNumberTest {
@Test
public void test() {
ThirdMaximumNumber thirdMaximumNumber = new ThirdMaximumNumber();
int[] nums4Failed = new int[] {5,2,4,1,3,6,0};
Assert.assertEquals(4, thirdMaximumNumber.thirdMax(nums4Failed));
int[] nums1 = new int[] {3, 2, 1};
Assert.assertEquals(1, thirdMaximumNumber.thirdMax(nums1));
int[] nums2 = new int[] {1, 2};
Assert.assertEquals(2, thirdMaximumNumber.thirdMax(nums2));
int[] nums1Another = new int[] {2, 2, 3, 1};
Assert.assertEquals(1, thirdMaximumNumber.thirdMax(nums1Another));
int[] nums4 = new int[] {3, 3, 4};
Assert.assertEquals(4, thirdMaximumNumber.thirdMax(nums4));
int[] nums9 = new int[] {2, 2, 3, 1, 9, 9, 8, 10, 200};
// System.out.println(thirdMaximumNumber.secondMax(2, 3, 1));
Assert.assertEquals(9, thirdMaximumNumber.thirdMax(nums9));
// 特殊情况
int[] nums3 = new int[] {1, 1, 1, 1, 1, 2, 2, 10, 3, 3, 3, 3, 3, 3, 8};
Assert.assertEquals(3, thirdMaximumNumber.thirdMax(nums3));
int[] nums7 = new int[] {7};
Assert.assertEquals(7, thirdMaximumNumber.thirdMax(nums7));
int[] nums6 = new int[] {6,6,6,6,6,6};
Assert.assertEquals(6, thirdMaximumNumber.thirdMax(nums6));
}
}