Skip to content

Test cases for binary tree added#1

Merged
michaelzhao820 merged 2 commits intomasterfrom
new_tests
Feb 24, 2026
Merged

Test cases for binary tree added#1
michaelzhao820 merged 2 commits intomasterfrom
new_tests

Conversation

@jiajuwang
Copy link
Collaborator

Test cases created for binary tree properties

@jiajuwang jiajuwang self-assigned this Feb 22, 2026
@@ -0,0 +1,118 @@
package org.ogo.test.createdatastructure.createbinarytree;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do not need a separate file for this; just keep in the same file

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

@BeforeAll
public static void initQueryEngine()
throws RemoteException, InterruptedException, IOException, NotBoundException {
Thread.sleep(4000);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to sleep?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sleep command gives time for Neo4JGraphQueryEngine to start before test runs. It also exists in all other test files.

int[] arr = new int[] {1, 2, 3, 4, 5, 6, 7};
BinaryTree tree = new BinaryTree();
Node root = tree.createTree(arr, 0, arr.length);
String nodeClass = "`org.ogo.test.createdatastructure.createbinarytree.Node`";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't we do Node.class?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will change hardcode class name to use reflection.

queryBool(
root,
"MATCH (a:"
+ nodeClass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need + in other tests/files or do we use String.format?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will change to String.format

Copy link
Member

@gliga gliga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seem my comments

import org.junit.jupiter.api.Test;
import org.ogo.client.OGO;

public class NewBinaryTreeTest {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please do a different Data Structure

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other BinaryTreeTest file is disabled so I add some new tests to see if OGO works for Binary tree data structure.

@michaelzhao820 michaelzhao820 merged commit dd4805c into master Feb 24, 2026
1 of 2 checks passed
@michaelzhao820 michaelzhao820 deleted the new_tests branch February 24, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants