// Path: src/src/com/orm/androrm/field/LocationField.java
// public class LocationField extends DataField<Location> {
// 
// 	public LocationField() {
// 		mType = "numeric";
// 	}
// 	
// 	/**
// 	 * As a location consists of longitude and latitude,
// 	 * this field will create 2 fields in the database.
// 	 */
// 	@Override
// 	public String getDefinition(String fieldName) {
// 		String definition = latName(fieldName) + " " + mType + ", ";
// 		definition += lngName(fieldName) + " " + mType; 
// 		
// 		return definition;
// 	}
// 	
// 	private String latName(String fieldName) {
// 		return fieldName + "Lat";
// 	}
// 	
// 	private String lngName(String fieldName) {
// 		return fieldName + "Lng";
// 	}
// 	
// 	@Override
// 	public void putData(String fieldName, ContentValues values) {
// 		double lat = 0.0;
// 		double lng = 0.0;
// 		
// 		if(mValue != null) {
// 			lat = mValue.getLatitude();
// 			lng = mValue.getLongitude();
// 		}
// 		
// 		values.put(latName(fieldName), lat);
// 		values.put(lngName(fieldName), lng);
// 	}
// 	
// 	@Override
// 	public void set(Cursor c, String fieldName) {
// 		double lat = c.getDouble(c.getColumnIndexOrThrow(latName(fieldName)));
// 		double lng = c.getDouble(c.getColumnIndexOrThrow(lngName(fieldName)));
// 		
// 		Location l = new Location(LocationManager.GPS_PROVIDER);
// 		l.setLatitude(lat);
// 		l.setLongitude(lng);
// 		
// 		mValue = l;
// 	}
// 
// 	@Override
// 	public void reset() {
// 		mValue = null;
// 	}
// 
// 	@Override
// 	public boolean addToAs(Context context, Class<? extends Model> model, String name) {
// 		String latSQL = "ALTER TABLE `" + DatabaseBuilder.getTableName(model) + "` "
// 						+ "ADD COLUMN `" + latName(name) + "` " + mType;
// 		
// 		String lngSQL = "ALTER TABLE `" + DatabaseBuilder.getTableName(model) + "` "
// 						+ "ADD COLUMN `" + lngName(name) + "` " + mType; 
// 		
// 		
// 		return exec(context, model, latSQL) && exec(context, model, lngSQL);
// 	}
// 
// }
// 
// Path: test/src/com/orm/androrm/impl/BlankModel.java
// public class BlankModel extends Model {
// 
// 	public static final QuerySet<BlankModel> objects(Context context) {
// 		return objects(context, BlankModel.class);
// 	}
// 	
// 	protected CharField mName;
// 	protected LocationField mLocation;
// 	protected DateField mDate;
// 	
// 	public BlankModel() {
// 		super();
// 		
// 		mName = new CharField();
// 		mLocation = new LocationField();
// 		mDate = new DateField();
// 	}
// 	
// 	public void setName(String name) {
// 		mName.set(name);
// 	}
// 	
// 	public String getName() {
// 		return mName.get();
// 	}
// 	
// 	public void setLocation(Location l) {
// 		mLocation.set(l);
// 	}
// 	
// 	public Location getLocation() {
// 		return mLocation.get();
// 	}
// 	
// 	public Date getDate() {
// 		return mDate.get();
// 	}
// 	
// 	public void setDate(Date date) {
// 		mDate.set(date);
// 	}
// }


import java.util.ArrayList;
import java.util.List;
import android.location.Location;
import android.location.LocationManager;
import android.test.AndroidTestCase;
import com.orm.androrm.DatabaseAdapter;
import com.orm.androrm.Model;
import com.orm.androrm.field.LocationField;
import com.orm.androrm.impl.BlankModel;
package com.orm.androrm.test.field;




public class LocationFieldTest extends AndroidTestCase {

	@Override
	public void setUp() {
		List<Class<? extends Model>> models = new ArrayList<Class<? extends Model>>();
		models.add(BlankModel.class);

		DatabaseAdapter adapter = DatabaseAdapter.getInstance(getContext());
		adapter.setModels(models);
	}

	@Override
	public void tearDown() {
		DatabaseAdapter adapter = DatabaseAdapter.getInstance(getContext());
		adapter.drop();
	}

	public void testDefinition() {
// Path: src/src/com/orm/androrm/field/LocationField.java
// public class LocationField extends DataField<Location> {
// 
// 	public LocationField() {
// 		mType = "numeric";
// 	}
// 	
// 	/**
// 	 * As a location consists of longitude and latitude,
// 	 * this field will create 2 fields in the database.
// 	 */
// 	@Override
// 	public String getDefinition(String fieldName) {
// 		String definition = latName(fieldName) + " " + mType + ", ";
// 		definition += lngName(fieldName) + " " + mType; 
// 		
// 		return definition;
// 	}
// 	
// 	private String latName(String fieldName) {
// 		return fieldName + "Lat";
// 	}
// 	
// 	private String lngName(String fieldName) {
// 		return fieldName + "Lng";
// 	}
// 	
// 	@Override
// 	public void putData(String fieldName, ContentValues values) {
// 		double lat = 0.0;
// 		double lng = 0.0;
// 		
// 		if(mValue != null) {
// 			lat = mValue.getLatitude();
// 			lng = mValue.getLongitude();
// 		}
// 		
// 		values.put(latName(fieldName), lat);
// 		values.put(lngName(fieldName), lng);
// 	}
// 	
// 	@Override
// 	public void set(Cursor c, String fieldName) {
// 		double lat = c.getDouble(c.getColumnIndexOrThrow(latName(fieldName)));
// 		double lng = c.getDouble(c.getColumnIndexOrThrow(lngName(fieldName)));
// 		
// 		Location l = new Location(LocationManager.GPS_PROVIDER);
// 		l.setLatitude(lat);
// 		l.setLongitude(lng);
// 		
// 		mValue = l;
// 	}
// 
// 	@Override
// 	public void reset() {
// 		mValue = null;
// 	}
// 
// 	@Override
// 	public boolean addToAs(Context context, Class<? extends Model> model, String name) {
// 		String latSQL = "ALTER TABLE `" + DatabaseBuilder.getTableName(model) + "` "
// 						+ "ADD COLUMN `" + latName(name) + "` " + mType;
// 		
// 		String lngSQL = "ALTER TABLE `" + DatabaseBuilder.getTableName(model) + "` "
// 						+ "ADD COLUMN `" + lngName(name) + "` " + mType; 
// 		
// 		
// 		return exec(context, model, latSQL) && exec(context, model, lngSQL);
// 	}
// 
// }
// 
// Path: test/src/com/orm/androrm/impl/BlankModel.java
// public class BlankModel extends Model {
// 
// 	public static final QuerySet<BlankModel> objects(Context context) {
// 		return objects(context, BlankModel.class);
// 	}
// 	
// 	protected CharField mName;
// 	protected LocationField mLocation;
// 	protected DateField mDate;
// 	
// 	public BlankModel() {
// 		super();
// 		
// 		mName = new CharField();
// 		mLocation = new LocationField();
// 		mDate = new DateField();
// 	}
// 	
// 	public void setName(String name) {
// 		mName.set(name);
// 	}
// 	
// 	public String getName() {
// 		return mName.get();
// 	}
// 	
// 	public void setLocation(Location l) {
// 		mLocation.set(l);
// 	}
// 	
// 	public Location getLocation() {
// 		return mLocation.get();
// 	}
// 	
// 	public Date getDate() {
// 		return mDate.get();
// 	}
// 	
// 	public void setDate(Date date) {
// 		mDate.set(date);
// 	}
// }


// Path: test/src/com/orm/androrm/test/field/LocationFieldTest.java
import java.util.ArrayList;
import java.util.List;
import android.location.Location;
import android.location.LocationManager;
import android.test.AndroidTestCase;
import com.orm.androrm.DatabaseAdapter;
import com.orm.androrm.Model;
import com.orm.androrm.field.LocationField;
import com.orm.androrm.impl.BlankModel;

package com.orm.androrm.test.field;




public class LocationFieldTest extends AndroidTestCase {

	@Override
	public void setUp() {
		List<Class<? extends Model>> models = new ArrayList<Class<? extends Model>>();
		models.add(BlankModel.class);

		DatabaseAdapter adapter = DatabaseAdapter.getInstance(getContext());
		adapter.setModels(models);
	}

	@Override
	public void tearDown() {
		DatabaseAdapter adapter = DatabaseAdapter.getInstance(getContext());
		adapter.drop();
	}

	public void testDefinition() {
		LocationField field = new LocationField();