Skip to content

Commit

Permalink
[WIP] Add Nan to ValuesGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
Akirathan committed Feb 23, 2023
1 parent 1d1815f commit d7e715d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
package org.enso.interpreter.test;

import java.io.ByteArrayOutputStream;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.URI;
import java.nio.file.Paths;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import org.enso.interpreter.runtime.type.ConstantsGen;
import org.enso.polyglot.RuntimeOptions;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Engine;
import org.graalvm.polyglot.Language;
import org.graalvm.polyglot.Source;
import org.graalvm.polyglot.Value;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ public Value typeDecimal() {
""", "Decimal").type();
}

public Value typeNan() {
return v("typeNan", """
from Standard.Base import Nothing, Vector, Number, Decimal, Integer, Nan
""", "Nan").type();
}

public Value typeBoolean() {
return v("typeBoolean", """
import Standard.Base.Data.Boolean.Boolean
Expand Down Expand Up @@ -279,6 +285,7 @@ public List<Value> numbers() {
collect.add(v(null, "", "123 * 10^40").type());
collect.add(v(null, "", "123 * 10^40 + 0.0").type());
collect.add(v(null, "", "123 * 10^40 + 1.0").type());
collect.add(v(null, "import Standard.Base.Data.Numbers.Number", "Number.nan").type());
}

if (languages.contains(Language.JAVA)) {
Expand All @@ -288,6 +295,7 @@ public List<Value> numbers() {
collect.add(ctx.asValue((long) 5435432));
collect.add(ctx.asValue((float) Math.PI));
collect.add(ctx.asValue((double) Math.E));
collect.add(ctx.asValue(Double.NaN));
}

for (var v : collect) {
Expand Down

0 comments on commit d7e715d

Please sign in to comment.