// Path: src/src/com/orm/androrm/field/IntegerField.java
// public class IntegerField extends DataField<Integer> {
// 
// 	/**
// 	 * Initializes a new {@link IntegerField} with default 
// 	 * value 0.
// 	 */
// 	public IntegerField() {
// 		mType = "integer";
// 		mValue = 0;
// 	}
// 	
// 	/**
// 	 * Initializes a new {@link IntegerField} with default 
// 	 * value 0 and sets the maximum length to maxLength if
// 	 * it is greater than 0 and less than or equal to 16.
// 	 * 
// 	 * @param maxLength	Maximum length of this field. 
// 	 */
// 	public IntegerField(int maxLength) {
// 		mType = "integer";
// 		
// 		if(maxLength > 0
// 				&& maxLength <= 16) {
// 			
// 			mMaxLength = maxLength;
// 		}
// 	}
// 
// 	@Override
// 	public void putData(String key, ContentValues values) {
// 		values.put(key, get());
// 	}
// 
// 	@Override
// 	public void set(Cursor c, String fieldName) {
// 		set(c.getInt(c.getColumnIndexOrThrow(fieldName)));
// 	}
// 
// 	@Override
// 	public void reset() {
// 		mValue = 0;
// 	}
// 	
// }
// 
// Path: test/src/com/orm/androrm/impl/Product.java
// public class Product extends Model {
// 
// 	public static final QuerySet<Product> objects(Context context) {
// 		return objects(context, Product.class);
// 	}
// 	
// 	protected CharField mName;
// 	protected ManyToManyField<Product, Branch> mBranches;
// 	
// 	public Product() {
// 		super();
// 		
// 		mName = new CharField(50);
// 		mBranches = new ManyToManyField<Product, Branch>(Product.class, Branch.class);
// 	}
// 
// 	public void setName(String name) {
// 		mName.set(name);
// 	}
// 	
// 	public String getName() {
// 		return mName.get();
// 	}
// 	
// 	public void addBranch(Branch branch) {
// 		mBranches.add(branch);
// 	}
// 	
// 	public void addBranches(List<Branch> branches) {
// 		mBranches.addAll(branches);
// 	}
// 	
// 	public QuerySet<Branch> getBranches(Context context) {
// 		return mBranches.get(context, this);
// 	}
// 	
// 	public int branchCount(Context context) {
// 		return mBranches.get(context, this).count();
// 	}
// 	
// }


import java.util.List;
import android.test.AndroidTestCase;
import com.orm.androrm.Model;
import com.orm.androrm.TableDefinition;
import com.orm.androrm.field.ForeignKeyField;
import com.orm.androrm.field.IntegerField;
import com.orm.androrm.impl.Product;
package com.orm.androrm.test.definition;




public class TableDefinitionTest extends AndroidTestCase {

	public void testTableName() {
		TableDefinition def = new TableDefinition("foo");
		
		assertEquals("foo", def.getTableName());
		assertEquals("CREATE TABLE IF NOT EXISTS `foo` ();", def.toString());
	}
	
	public void testAddSimpleField() {
		TableDefinition def = new TableDefinition("foo");
		IntegerField i = new IntegerField();
		
		def.addField("pk", i);

		assertEquals("CREATE TABLE IF NOT EXISTS `foo` (`pk` integer);", def.toString());
	}
	
	public void testForeignKeyField() {
		TableDefinition def = new TableDefinition("foo");
// Path: src/src/com/orm/androrm/field/IntegerField.java
// public class IntegerField extends DataField<Integer> {
// 
// 	/**
// 	 * Initializes a new {@link IntegerField} with default 
// 	 * value 0.
// 	 */
// 	public IntegerField() {
// 		mType = "integer";
// 		mValue = 0;
// 	}
// 	
// 	/**
// 	 * Initializes a new {@link IntegerField} with default 
// 	 * value 0 and sets the maximum length to maxLength if
// 	 * it is greater than 0 and less than or equal to 16.
// 	 * 
// 	 * @param maxLength	Maximum length of this field. 
// 	 */
// 	public IntegerField(int maxLength) {
// 		mType = "integer";
// 		
// 		if(maxLength > 0
// 				&& maxLength <= 16) {
// 			
// 			mMaxLength = maxLength;
// 		}
// 	}
// 
// 	@Override
// 	public void putData(String key, ContentValues values) {
// 		values.put(key, get());
// 	}
// 
// 	@Override
// 	public void set(Cursor c, String fieldName) {
// 		set(c.getInt(c.getColumnIndexOrThrow(fieldName)));
// 	}
// 
// 	@Override
// 	public void reset() {
// 		mValue = 0;
// 	}
// 	
// }
// 
// Path: test/src/com/orm/androrm/impl/Product.java
// public class Product extends Model {
// 
// 	public static final QuerySet<Product> objects(Context context) {
// 		return objects(context, Product.class);
// 	}
// 	
// 	protected CharField mName;
// 	protected ManyToManyField<Product, Branch> mBranches;
// 	
// 	public Product() {
// 		super();
// 		
// 		mName = new CharField(50);
// 		mBranches = new ManyToManyField<Product, Branch>(Product.class, Branch.class);
// 	}
// 
// 	public void setName(String name) {
// 		mName.set(name);
// 	}
// 	
// 	public String getName() {
// 		return mName.get();
// 	}
// 	
// 	public void addBranch(Branch branch) {
// 		mBranches.add(branch);
// 	}
// 	
// 	public void addBranches(List<Branch> branches) {
// 		mBranches.addAll(branches);
// 	}
// 	
// 	public QuerySet<Branch> getBranches(Context context) {
// 		return mBranches.get(context, this);
// 	}
// 	
// 	public int branchCount(Context context) {
// 		return mBranches.get(context, this).count();
// 	}
// 	
// }


// Path: test/src/com/orm/androrm/test/definition/TableDefinitionTest.java
import java.util.List;
import android.test.AndroidTestCase;
import com.orm.androrm.Model;
import com.orm.androrm.TableDefinition;
import com.orm.androrm.field.ForeignKeyField;
import com.orm.androrm.field.IntegerField;
import com.orm.androrm.impl.Product;

package com.orm.androrm.test.definition;




public class TableDefinitionTest extends AndroidTestCase {

	public void testTableName() {
		TableDefinition def = new TableDefinition("foo");
		
		assertEquals("foo", def.getTableName());
		assertEquals("CREATE TABLE IF NOT EXISTS `foo` ();", def.toString());
	}
	
	public void testAddSimpleField() {
		TableDefinition def = new TableDefinition("foo");
		IntegerField i = new IntegerField();
		
		def.addField("pk", i);

		assertEquals("CREATE TABLE IF NOT EXISTS `foo` (`pk` integer);", def.toString());
	}
	
	public void testForeignKeyField() {
		TableDefinition def = new TableDefinition("foo");
		ForeignKeyField<Product> fk = new ForeignKeyField<Product>(Product.class);