<commit_before>package core

import (
	"testing"

	context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
	config "github.com/jbenet/go-ipfs/repo/config"
)

func TestInitialization(t *testing.T) {
	ctx := context.TODO()
	id := testIdentity

	good := []*config.Config{
		&config.Config{
			Identity: id,
			Datastore: config.Datastore{
				Type: "memory",
			},
			Addresses: config.Addresses{
				Swarm: []string{"/ip4/0.0.0.0/tcp/4001"},
				API:   "/ip4/127.0.0.1/tcp/8000",
			},
		},

		&config.Config{
			Identity: id,
			Datastore: config.Datastore{
				Type: "leveldb",
				Path: ".testdb",
			},
			Addresses: config.Addresses{
				Swarm: []string{"/ip4/0.0.0.0/tcp/4001"},
				API:   "/ip4/127.0.0.1/tcp/8000",
			},
		},
	}

	bad := []*config.Config{
		&config.Config{Identity: id, Datastore: config.Datastore{}},
		&config.Config{},
		&config.Config{Datastore: config.Datastore{Type: "memory"}},
	}

	for i, c := range good {
		n, err := NewIPFSNode(ctx, Standard(c, false))
		if n == nil || err != nil {
			t.Error("Should have constructed.", i, err)
		}
	}

	for i, c := range bad {
		n, err := NewIPFSNode(ctx, Standard(c, false))
		if n != nil || err == nil {
			t.Error("Should have failed to construct.", i)
		}
	}
}

var testIdentity = config.Identity{
	PeerID:  "QmNgdzLieYi8tgfo2WfTUzNVH5hQK9oAYGVf6dxN12NrHt",
	PrivKey: "<KEY>
}
<commit_msg>it's unclear what this test case is meant to protect, but passing an empty datastore value no longer has bearing on node construction. Datastore setup now occurs in repo.<commit_after>package core

import (
	"testing"

	context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
	config "github.com/jbenet/go-ipfs/repo/config"
)

func TestInitialization(t *testing.T) {
	ctx := context.TODO()
	id := testIdentity

	good := []*config.Config{
		&config.Config{
			Identity: id,
			Datastore: config.Datastore{
				Type: "memory",
			},
			Addresses: config.Addresses{
				Swarm: []string{"/ip4/0.0.0.0/tcp/4001"},
				API:   "/ip4/127.0.0.1/tcp/8000",
			},
		},

		&config.Config{
			Identity: id,
			Datastore: config.Datastore{
				Type: "leveldb",
				Path: ".testdb",
			},
			Addresses: config.Addresses{
				Swarm: []string{"/ip4/0.0.0.0/tcp/4001"},
				API:   "/ip4/127.0.0.1/tcp/8000",
			},
		},
	}

	bad := []*config.Config{
		&config.Config{},
		&config.Config{Datastore: config.Datastore{Type: "memory"}},
	}

	for i, c := range good {
		n, err := NewIPFSNode(ctx, Standard(c, false))
		if n == nil || err != nil {
			t.Error("Should have constructed.", i, err)
		}
	}

	for i, c := range bad {
		n, err := NewIPFSNode(ctx, Standard(c, false))
		if n != nil || err == nil {
			t.Error("Should have failed to construct.", i)
		}
	}
}

var testIdentity = config.Identity{
	PeerID:  "<KEY>",
	PrivKey: "<KEY>
}

{'fraction_non_alphanumeric': 0.17936117936117937, 'fraction_numerical': 0.030537030537030538, 'mean_word_length': 3.209748892171344, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 8, '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': '4777676', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1134, 'n_words': 230}