// Path: src/src/com/orm/androrm/OrderBy.java
// public class OrderBy {
// 
// 	private String mOrderBy;
// 	
// 	/**
// 	 * Add an ORDER BY statement. For convenience ASC and DESC can
// 	 * be toggled by adding a preceding a <code>+</code> or <code>-</code>
// 	 * to the table column. In order to sort the table column in numerical
// 	 * order add the prefix #.
// 	 * <br /><br />
// 	 * For example <code>-foo</code> will result in <code>foo DESC</code>.
// 	 * <br /><br />
// 	 * If no preceding <code>+</code> or <code>-</code> is given 
// 	 * <code>ASC</code> is assumed.
// 	 * 
// 	 * @param col Name of the table column.
// 	 */
// 	public OrderBy(String... columns) {
// 		boolean first = true;
// 		
// 		for(int i = 0, length = columns.length; i < length; i++) {
// 			String col = columns[i];
// 			
// 			if(!first) {
// 				mOrderBy += ", ";
// 			} else {
// 				mOrderBy = " ";
// 			}
// 			if(col.startsWith("#")) {
// 				if(col.startsWith("-")) {
// 					mOrderBy += "CAST(" +col.substring(2) + " AS INTEGER) DESC";
// 				} else if(col.startsWith("+")) {
// 					mOrderBy += "CAST(" +col.substring(2) + " AS INTEGER) ASC";
// 				} else {
// 					mOrderBy += "CAST(" +col.substring(1)  + " AS INTEGER) ASC";
// 				}
// 			}else{
// 				if(col.startsWith("-")) {
// 					mOrderBy += "UPPER(" + col.substring(1) + ") DESC";
// 				} else if(col.startsWith("+")) {
// 					mOrderBy += "UPPER(" + col.substring(1) + ") ASC";
// 				} else {
// 					mOrderBy += "UPPER(" + col + ") ASC";
// 				}
// 			}
// 			
// 			if(first) {
// 				first = false;
// 			}
// 		}
// 	}
// 	
// 	@Override
// 	public String toString() {
// 		return " ORDER BY" + mOrderBy;
// 	}
// }


import com.orm.androrm.OrderBy;
import android.test.AndroidTestCase;
package com.orm.androrm.test.statement;



public class OrderByTest extends AndroidTestCase {

	public void testDefault() {
		OrderBy o = new OrderBy("col");
		
		assertEquals(" ORDER BY UPPER(col) ASC", o.toString());
	}
	
	public void testASC() {
		OrderBy o = new OrderBy("+col");
		
		assertEquals(" ORDER BY UPPER(col) ASC", o.toString());
	}
	
	public void testDESC() {
		OrderBy o = new OrderBy("-col");
		
		assertEquals(" ORDER BY UPPER(col) DESC", o.toString());
	}
	
	public void testMultiple() {
// Path: src/src/com/orm/androrm/OrderBy.java
// public class OrderBy {
// 
// 	private String mOrderBy;
// 	
// 	/**
// 	 * Add an ORDER BY statement. For convenience ASC and DESC can
// 	 * be toggled by adding a preceding a <code>+</code> or <code>-</code>
// 	 * to the table column. In order to sort the table column in numerical
// 	 * order add the prefix #.
// 	 * <br /><br />
// 	 * For example <code>-foo</code> will result in <code>foo DESC</code>.
// 	 * <br /><br />
// 	 * If no preceding <code>+</code> or <code>-</code> is given 
// 	 * <code>ASC</code> is assumed.
// 	 * 
// 	 * @param col Name of the table column.
// 	 */
// 	public OrderBy(String... columns) {
// 		boolean first = true;
// 		
// 		for(int i = 0, length = columns.length; i < length; i++) {
// 			String col = columns[i];
// 			
// 			if(!first) {
// 				mOrderBy += ", ";
// 			} else {
// 				mOrderBy = " ";
// 			}
// 			if(col.startsWith("#")) {
// 				if(col.startsWith("-")) {
// 					mOrderBy += "CAST(" +col.substring(2) + " AS INTEGER) DESC";
// 				} else if(col.startsWith("+")) {
// 					mOrderBy += "CAST(" +col.substring(2) + " AS INTEGER) ASC";
// 				} else {
// 					mOrderBy += "CAST(" +col.substring(1)  + " AS INTEGER) ASC";
// 				}
// 			}else{
// 				if(col.startsWith("-")) {
// 					mOrderBy += "UPPER(" + col.substring(1) + ") DESC";
// 				} else if(col.startsWith("+")) {
// 					mOrderBy += "UPPER(" + col.substring(1) + ") ASC";
// 				} else {
// 					mOrderBy += "UPPER(" + col + ") ASC";
// 				}
// 			}
// 			
// 			if(first) {
// 				first = false;
// 			}
// 		}
// 	}
// 	
// 	@Override
// 	public String toString() {
// 		return " ORDER BY" + mOrderBy;
// 	}
// }


// Path: test/src/com/orm/androrm/test/statement/OrderByTest.java
import com.orm.androrm.OrderBy;
import android.test.AndroidTestCase;

package com.orm.androrm.test.statement;



public class OrderByTest extends AndroidTestCase {

	public void testDefault() {
		OrderBy o = new OrderBy("col");
		
		assertEquals(" ORDER BY UPPER(col) ASC", o.toString());
	}
	
	public void testASC() {
		OrderBy o = new OrderBy("+col");
		
		assertEquals(" ORDER BY UPPER(col) ASC", o.toString());
	}
	
	public void testDESC() {
		OrderBy o = new OrderBy("-col");
		
		assertEquals(" ORDER BY UPPER(col) DESC", o.toString());
	}
	
	public void testMultiple() {
		OrderBy o = new OrderBy("col1", "-col2", "+col3");