UnitTest.java revision ff4d70872aa48675a06fc4673c732860c1619758
1ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines/* 2ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines * Copyright (C) 2010 The Android Open Source Project 3ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines * 4ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines * Licensed under the Apache License, Version 2.0 (the "License"); 5ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines * you may not use this file except in compliance with the License. 6ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines * You may obtain a copy of the License at 7ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines * 8ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines * http://www.apache.org/licenses/LICENSE-2.0 9ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines * 10ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines * Unless required by applicable law or agreed to in writing, software 11ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines * distributed under the License is distributed on an "AS IS" BASIS, 12ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines * See the License for the specific language governing permissions and 14ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines * limitations under the License. 15ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines */ 16ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines 17ff4d70872aa48675a06fc4673c732860c1619758Stephen Hinespackage com.android.rs.test; 18ff4d70872aa48675a06fc4673c732860c1619758Stephen Hinesimport android.renderscript.RenderScript.RSMessage; 19ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines 20ff4d70872aa48675a06fc4673c732860c1619758Stephen Hinespublic class UnitTest extends Thread { 21ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines public String name; 22ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines public int result; 23ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines 24ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines /* These constants must match those in shared.rsh */ 25ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines public static final int RS_MSG_TEST_PASSED = 100; 26ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines public static final int RS_MSG_TEST_FAILED = 101; 27ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines 28ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines protected UnitTest(String n, int initResult) { 29ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines super(); 30ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines name = n; 31ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines result = initResult; 32ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines } 33ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines 34ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines protected UnitTest(String n) { 35ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines this(n, 0); 36ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines } 37ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines 38ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines protected UnitTest() { 39ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines this ("<Unknown>"); 40ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines } 41ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines 42ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines protected RSMessage mRsMessage = new RSMessage() { 43ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines public void run() { 44ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines switch (mID) { 45ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines case RS_MSG_TEST_PASSED: 46ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines result = 1; 47ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines break; 48ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines case RS_MSG_TEST_FAILED: 49ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines result = -1; 50ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines break; 51ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines default: 52ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines break; 53ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines } 54ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines } 55ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines }; 56ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines 57ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines public void run() { 58ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines /* This method needs to be implemented for each subclass */ 59ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines } 60ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines} 61ff4d70872aa48675a06fc4673c732860c1619758Stephen Hines 62