Work in progress.

Able to read short survey, recipe book but crashing in Bayes Net code.
This commit is contained in:
Woody Folsom
2012-03-11 21:25:04 -04:00
parent 3046f68681
commit bb94356ec1
11 changed files with 999 additions and 37 deletions

View File

@@ -29,7 +29,7 @@ public class RecipeBookReaderTest {
assertTrue(recipe.getIngredients().contains(TYPE.EGGS));
assertTrue(recipe.getIngredients().contains(TYPE.GLUTEN));
assertTrue(recipe.getIngredients().contains(TYPE.SPICE));
assertFalse(recipe.getIngredients().contains(TYPE.RED_MEAT));
assertFalse(recipe.getIngredients().contains(TYPE.BEEF));
assertFalse(recipe.getIngredients().contains(TYPE.POULTRY));
assertFalse(recipe.getIngredients().contains(TYPE.SHELLFISH));
@@ -37,4 +37,44 @@ public class RecipeBookReaderTest {
System.out.println(recipeBook.getRecipe(rIndex).getHead().getTitle());
}
}
@Test
public void testReadShortSurveyDataset() {
RecipeBook recipeBook = RecipeBookReader.readRecipeBook(new File("data/short_recipebook.xml"));
assertNotNull(recipeBook);
assertThat(recipeBook.getSize(), is(equalTo(4)));
for (int i = 0; i < 4; i++) {
Recipe recipe = recipeBook.getRecipe(i);
System.out.println(i + ": " +recipe.getHead().getTitle());
}
Recipe recipe = recipeBook.getRecipe(0);
assertThat(recipe.getHead().getTitle(), is(equalTo("Catalan Rice")));
assertTrue(recipe.getIngredients().contains(TYPE.PORK));
assertFalse(recipe.getIngredients().contains(TYPE.BEEF));
assertFalse(recipe.getIngredients().contains(TYPE.POTATO));
assertTrue(recipe.getIngredients().contains(TYPE.TOMATO));
recipe = recipeBook.getRecipe(1);
assertThat(recipe.getHead().getTitle(), is(equalTo("Hamburger Steak")));
assertFalse(recipe.getIngredients().contains(TYPE.PORK));
assertTrue(recipe.getIngredients().contains(TYPE.BEEF));
assertFalse(recipe.getIngredients().contains(TYPE.POTATO));
assertFalse(recipe.getIngredients().contains(TYPE.TOMATO));
recipe = recipeBook.getRecipe(2);
assertThat(recipe.getHead().getTitle(), is(equalTo("Potatoes in a Thick Sauce")));
assertFalse(recipe.getIngredients().contains(TYPE.PORK));
assertFalse(recipe.getIngredients().contains(TYPE.BEEF));
assertTrue(recipe.getIngredients().contains(TYPE.POTATO));
assertTrue(recipe.getIngredients().contains(TYPE.TOMATO));
recipe = recipeBook.getRecipe(3);
assertThat(recipe.getHead().getTitle(), is(equalTo("Tomato-Zucchini Casserole")));
assertFalse(recipe.getIngredients().contains(TYPE.PORK));
assertFalse(recipe.getIngredients().contains(TYPE.BEEF));
assertFalse(recipe.getIngredients().contains(TYPE.POTATO));
assertTrue(recipe.getIngredients().contains(TYPE.TOMATO));
}
}