mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-27 22:43:30 +08:00
Co-authored-by: Amit Kumar <akumar@indeed.com> Co-authored-by: Andrii Siriak <siryaka@gmail.com>
This commit is contained in:
@ -0,0 +1,36 @@
|
||||
package com.thealgorithms.datastructures.trees;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* @author kumanoit on 10/10/22 IST 1:02 AM
|
||||
*/
|
||||
public class CheckTreeIsSymmetricTest {
|
||||
|
||||
@Test
|
||||
public void testRootNull() {
|
||||
assertTrue(CheckTreeIsSymmetric.isSymmetric(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSingleNodeTree() {
|
||||
final BinaryTree.Node root = TreeTestUtils.createTree(new Integer[]{100});
|
||||
assertTrue(CheckTreeIsSymmetric.isSymmetric(root));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSymmetricTree() {
|
||||
final BinaryTree.Node root = TreeTestUtils.createTree(new Integer[]{1,2,2,3,4,4,3});
|
||||
assertTrue(CheckTreeIsSymmetric.isSymmetric(root));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonSymmetricTree() {
|
||||
final BinaryTree.Node root = TreeTestUtils.createTree(new Integer[]{1,2,2,3,5,4,3});
|
||||
assertFalse(CheckTreeIsSymmetric.isSymmetric(root));
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user