All Downloads are FREE. Search and download functionalities are using the official Maven repository.

quark.test.Test Maven / Gradle / Ivy

There is a newer version: 2.0.37
Show newest version
/* Quark 1.0.452 run at 2016-11-11 16:09:46.008093 */
package quark.test;

public class Test implements io.datawire.quark.runtime.QObject {
    public static io.datawire.quark.runtime.TLS ctx = new io.datawire.quark.runtime.TLS(new TestInitializer());
    public static quark.reflect.Class quark_test_Test_ref = datawire_mdk_md.Root.quark_test_Test_md;
    public String name;
    public Integer checks = 0;
    public java.util.ArrayList successes = new java.util.ArrayList(java.util.Arrays.asList(new Object[]{}));
    public java.util.ArrayList failures = new java.util.ArrayList(java.util.Arrays.asList(new Object[]{}));
    public Test(String name) {
        (this).name = name;
    }
    public static Test current() {
        return (Test.ctx).getValue();
    }
    public Boolean match(java.util.ArrayList filters) {
        if (((filters)==(null) || ((Object)(filters) != null && ((Object) (filters)).equals(null))) || (((filters).size())==(0) || ((Object)((filters).size()) != null && ((Object) ((filters).size())).equals(0)))) {
            return true;
        }
        Integer idx = 0;
        while ((idx) < ((filters).size())) {
            String filter = (filters).get(idx);
            if (((this.name).indexOf(filter)) >= (0)) {
                return true;
            }
            idx = (idx) + (1);
        }
        return false;
    }
    public void start() {
        (Test.ctx).setValue(this);
    }
    public void stop() {
        String result = (((((this.name) + (" [")) + (Integer.toString(this.checks))) + (" checks, ")) + (Integer.toString((this.failures).size()))) + (" failures]");
        if (((this.failures).size()) > (0)) {
            do{System.out.println(Functions.red(result));System.out.flush();}while(false);
        } else {
            do{System.out.println(Functions.bold(result));System.out.flush();}while(false);
        }
        Integer idx = 0;
        while ((idx) < ((this.successes).size())) {
            do{System.out.println(Functions.green(("  PASS: ") + ((this.successes).get(idx))));System.out.flush();}while(false);
            idx = (idx) + (1);
        }
        idx = 0;
        while ((idx) < ((this.failures).size())) {
            do{System.out.println(Functions.red(("  FAIL: ") + ((this.failures).get(idx))));System.out.flush();}while(false);
            idx = (idx) + (1);
        }
        (Test.ctx).setValue(null);
    }
    public Boolean check(Boolean value, String message) {
        this.checks = (this.checks) + (1);
        if (value) {
            (this.successes).add(message);
        } else {
            (this.failures).add(message);
        }
        return value;
    }
    public void fail(String message) {
        this.check(false, message);
    }
    public void run() {}
    public String _getClass() {
        return "quark.test.Test";
    }
    public Object _getField(String name) {
        if ((name)==("ctx") || ((Object)(name) != null && ((Object) (name)).equals("ctx"))) {
            return Test.ctx;
        }
        if ((name)==("name") || ((Object)(name) != null && ((Object) (name)).equals("name"))) {
            return (this).name;
        }
        if ((name)==("checks") || ((Object)(name) != null && ((Object) (name)).equals("checks"))) {
            return (this).checks;
        }
        if ((name)==("successes") || ((Object)(name) != null && ((Object) (name)).equals("successes"))) {
            return (this).successes;
        }
        if ((name)==("failures") || ((Object)(name) != null && ((Object) (name)).equals("failures"))) {
            return (this).failures;
        }
        return null;
    }
    public void _setField(String name, Object value) {
        if ((name)==("ctx") || ((Object)(name) != null && ((Object) (name)).equals("ctx"))) {
            Test.ctx = (io.datawire.quark.runtime.TLS) (value);
        }
        if ((name)==("name") || ((Object)(name) != null && ((Object) (name)).equals("name"))) {
            (this).name = (String) (value);
        }
        if ((name)==("checks") || ((Object)(name) != null && ((Object) (name)).equals("checks"))) {
            (this).checks = (Integer) (value);
        }
        if ((name)==("successes") || ((Object)(name) != null && ((Object) (name)).equals("successes"))) {
            (this).successes = (java.util.ArrayList) (value);
        }
        if ((name)==("failures") || ((Object)(name) != null && ((Object) (name)).equals("failures"))) {
            (this).failures = (java.util.ArrayList) (value);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy