TestBase.java
/**
* Copyright 2010,2021 Nikolas S Boyd.
Permission is granted to copy this work provided this copyright statement is retained in all copies.
*/
package Hoot.Tests;
import Hoot.Runtime.Functions.*;
import Hoot.Runtime.Faces.*;
import Hoot.Runtime.Values.*;
import Hoot.Runtime.Blocks.*;
import Smalltalk.Core.*;
import Smalltalk.Blocks.*;
import Smalltalk.Magnitudes.*;
import Hoot.Behaviors.*;
import Hoot.Behaviors.Nil;
import Hoot.Behaviors.Object;
import Hoot.Behaviors.True;
import Hoot.Behaviors.False;
import Hoot.Behaviors.Boolean;
import Hoot.Magnitudes.*;
import Hoot.Magnitudes.Integer;
import Hoot.Magnitudes.Character;
import Hoot.Magnitudes.Float;
import Hoot.Magnitudes.Double;
import Hoot.Collections.*;
import Hoot.Collections.String;
import org.junit.*;
import Hoot.Streams.Transcript;
public abstract class TestBase extends Object implements Testable
{
public static Metaclass type() { return (Metaclass)Metaclass.$class; }
@Override public Metaclass $class() { return (Metaclass)Metaclass.$class; }
public static class Metaclass extends Object.Metaclass implements Testable.Metatype
{
static final TestBase.Metaclass $class = new TestBase.Metaclass();
public Metaclass() {
this(TestBase.Metaclass.class);
}
public Metaclass(java.lang.Class aClass) {
super(aClass);
}
@Override public java.lang.Class outerClass() { return TestBase.class; }
}
/**
* @return
*/
@Override public void runTest()
{
java.lang.String exitID = "TestBase>>runTest";
Frame f0 = new Frame(exitID);
}
/**
* @return
*/
@Test public void testOnce()
{
java.lang.String exitID = "TestBase>>testOnce";
Frame f0 = new Frame(exitID);
this.log().cr();
this.runTest();
this.log().cr();
}
/**
* @return
*/
public void assertTrue(final Closure test)
{
java.lang.String exitID = "TestBase>>assertTrue";
Frame f0 = new Frame(exitID);
Assert.assertTrue(test.toPredicate().value().primitiveBoolean());
}
/**
* @return
*/
public void assertFalse(final Closure test)
{
java.lang.String exitID = "TestBase>>assertFalse";
Frame f0 = new Frame(exitID);
Assert.assertFalse(test.toPredicate().value().primitiveBoolean());
}
/**
* @return
*/
public void assertTrue_with(final Closure test, final Hoot.Behaviors.Object argument)
{
java.lang.String exitID = "TestBase>>assertTrue_with";
Frame f0 = new Frame(exitID);
Assert.assertTrue(test.toPredicate().value(argument).primitiveBoolean());
}
/**
* @return
*/
public void assertFalse_with(final Closure test, final Hoot.Behaviors.Object argument)
{
java.lang.String exitID = "TestBase>>assertFalse_with";
Frame f0 = new Frame(exitID);
Assert.assertFalse(test.toPredicate().value(argument).primitiveBoolean());
}
/**
* @return
*/
public Transcript log()
{
java.lang.String exitID = "TestBase>>log";
Frame f0 = new Frame(exitID);
return (Transcript)Transcript.log();
}
/**
* @return
*/
public void report(final String message)
{
java.lang.String exitID = "TestBase>>report";
Frame f0 = new Frame(exitID);
this.log().printLine(message);
}
/**
* @return
*/
public void passed(final String testName)
{
java.lang.String exitID = "TestBase>>passed";
Frame f0 = new Frame(exitID);
this.report((String.from("passed: ").append(testName)));
}
/**
* @return
*/
public void recycleGarbage()
{
java.lang.String exitID = "TestBase>>recycleGarbage";
Frame f0 = new Frame(exitID);
java.lang.Runtime.getRuntime().gc();
}
}