/*
 *  Copyright (C) 2011 The Animo Project
 *  http://animotron.org
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public License
 *  as published by the Free Software Foundation; either version 3
 *  of the License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
package org.animotron.games.whouse;

import org.animotron.ATest;
import org.junit.Test;

/**
 * @author <a href="mailto:shabanovd@gmail.com">Dmitriy Shabanov</a>
 *
 */
public class DocumentTest extends ATest {

	@Test
	public void test() throws Exception {
		
		testAnimo("the user1 have name \"user1\".");
		testAnimo("the user2 have name \"user1\".");

		testAnimo("the number have name \"number\".");
		testAnimo("the date have name \"date\".");
		testAnimo("the owner have name \"owner\".");

		testAnimo("the document (have date) (have number) (have owner).");
		
		testAnimo("the doc3 (is document) (have date \"2011-11-01\") (have number \"3\") (have owner user1).");
		testAnimo("the doc5 (is document) (have date \"2011-11-02\") (have number \"5\") (have owner user1).");
		testAnimo("the doc7 (is document) (have date \"2011-11-03\") (have number \"7\") (have owner user2).");
		
		testAnimo("the table " +
					"(have column) " +
					"(have row) " +
					"(ic html " +
						"\\table " +
							"(\\tr each (get column) (\\th get name) ) " +
							"(each (get row) (\\tr each (get column) (\\td get name) )" +
					").");
		
		testAnimo("the journal (is table) (have column (an date) (an number)) (have row all document).");
		
		testAnimoResult("get html an journal", 
			"<table>" +
				"<tr>" +
					"<th>date</th>" +
					"<th>number</th>" +
				"</tr>" +
				"<tr>" +
					"<td>2011-11-01</td>" +
					"<td>3</td>" +
				"</tr>" +
				"<tr>" +
					"<td>2011-11-02</td>" +
					"<td>5</td>" +
				"</tr>" +
				"<tr>" +
					"<td>2011-11-03</td>" +
					"<td>7</td>" +
				"</tr>" +
			"</table>");
	}
}

@@ -863,16 +863,65 @@
 .ATest;%0A
+import org.animotron.expression.AnimoExpression;%0A
 import o
@@ -1410,26 +1410,24 @@
  owner).%22);%0A
-%09%09
 %0A%09%09testAnimo
@@ -1893,17 +1893,16 @@
 et name)
- 
 ) %22 +%0A%09%09
@@ -1962,17 +1962,17 @@
 et name)
- 
+)
 )%22 +%0A%09%09%09
@@ -2037,21 +2037,15 @@
 mn (
-an 
 date) (
-an 
 numb
@@ -2081,28 +2081,59 @@
 %22);%0A
-%09%09
 %0A%09%09
-testAnimoResult
+assertXMLResult(%0A            new AnimoExpression
 (%22ge
@@ -2143,19 +2143,16 @@
 tml 
-an 
 journal%22
 , %0A%09
@@ -2147,18 +2147,18 @@
 journal%22
+)
 ,
- 
 %0A%09%09%09%22%3Cta
@@ -2484,13 +2484,14 @@
 ble%3E%22);%0A
+%0A
 %09%7D%0A%7D%0A

fix DocumentTest