<commit_before>// Utility to perform basic checks on supplied data files for blocks, items and
// recipes.
package main

import (
	"flag"
	"log"
	"os"

	"chunkymonkey/block"
	"chunkymonkey/itemtype"
	"chunkymonkey/recipe"
)

var blockDefs = flag.String(
	"blocks", "blocks.json",
	"The JSON file containing block type definitions.")

var itemDefs = flag.String(
	"items", "items.json",
	"The JSON file containing item type definitions.")

var recipeDefs = flag.String(
	"recipes", "recipes.json",
	"The JSON file containing recipe definitions.")

func main() {
	var err os.Error

	blockTypes, err := block.LoadBlocksFromFile(*blockDefs)
	if err != nil {
		log.Print("Error loading block definitions: ", err)
		os.Exit(1)
	}

	itemTypes, err := itemtype.LoadItemTypesFromFile(*itemDefs)
	if err != nil {
		log.Print("Error loading item definitions: ", err)
		os.Exit(1)
	}

	blockTypes.CreateBlockItemTypes(itemTypes)

	recipes, err := recipe.LoadRecipesFromFile(*recipeDefs, itemTypes)
	if err != nil {
		log.Print("Error loading recipe definitions: ", err)
		os.Exit(1)
	}

	log.Printf(
		"Successfully loaded %d block types, %d item types and %d recipes.",
		len(blockTypes), len(itemTypes), len(recipes.Recipes))
}<commit_msg>Changed datatests to remove use of log package and print success on stdout.<commit_after>// Utility to perform basic checks on supplied data files for blocks, items and
// recipes.
package main

import (
	"flag"
	"fmt"
	"os"

	"chunkymonkey/block"
	"chunkymonkey/itemtype"
	"chunkymonkey/recipe"
)

var blockDefs = flag.String(
	"blocks", "blocks.json",
	"The JSON file containing block type definitions.")

var itemDefs = flag.String(
	"items", "items.json",
	"The JSON file containing item type definitions.")

var recipeDefs = flag.String(
	"recipes", "recipes.json",
	"The JSON file containing recipe definitions.")

func main() {
	var err os.Error

	blockTypes, err := block.LoadBlocksFromFile(*blockDefs)
	if err != nil {
		fmt.Fprintf(os.Stdout, "Error loading block definitions: %v\n", err)
		os.Exit(1)
	}

	itemTypes, err := itemtype.LoadItemTypesFromFile(*itemDefs)
	if err != nil {
		fmt.Fprintf(os.Stdout, "Error loading item definitions: %v\n", err)
		os.Exit(1)
	}

	blockTypes.CreateBlockItemTypes(itemTypes)

	_, err = recipe.LoadRecipesFromFile(*recipeDefs, itemTypes)
	if err != nil {
		fmt.Fprintf(os.Stdout, "Error loading recipe definitions: %v\n", err)
		os.Exit(1)
	}

	fmt.Printf("PASS datatests\n")
}
{'fraction_non_alphanumeric': 0.1295315682281059, 'fraction_numerical': 0.002443991853360489, 'mean_word_length': 4.494407158836689, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5419006', 'n_tokens_mistral': 864, 'n_tokens_neox': 836, 'n_words': 238}