Skip to content

Commit

Permalink
fix unit test #511 #502
Browse files Browse the repository at this point in the history
  • Loading branch information
walterxie committed Jul 29, 2024
1 parent b882f6d commit ccae8f1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lphy-base/src/test/java/lphy/base/ResampleTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package lphy.base;

import lphy.base.evolution.Taxa;
import lphy.base.evolution.tree.TimeTree;
import lphy.core.model.Value;
import lphy.core.parser.LPhyListenerImpl;
Expand All @@ -11,15 +12,15 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

import static lphy.core.parser.ParserSingleton.getParser;
import static lphy.core.parser.ParserSingleton.parse;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.*;

public class ResampleTest {

Expand Down Expand Up @@ -134,9 +135,15 @@ public void testDataModel() {
Value treeV2 = modelDict.get("ψ");

// same taxa, because it is in data block
assertEquals(taxaV, taxaV2);
String[] taxa1 = ((Taxa) taxaV.value()).getTaxaNames();
Arrays.sort(taxa1);
String[] taxa2 = ((Taxa) taxaV.value()).getTaxaNames();
Arrays.sort(taxa2);
assertArrayEquals(taxa1, taxa2);
// different tree (model block, and tree is Random Var)
assertNotEquals(treeV, treeV2);
int n1 = ((TimeTree) treeV.value()).n();
int n2 = ((TimeTree) treeV2.value()).n();
assertEquals(n1, n2);

}

Expand Down

0 comments on commit ccae8f1

Please sign in to comment.