<commit_before>using GLib;
using Wiz;
using Graph;

namespace Wiz {
	class Test : GLib.Object {
		public void test_wizbit_1() {
			/*
			GLib.Cancellable c;
			OutputStream stream;

			Object obj = new Object();

			stream = obj.create_next_version();
			stream.write("test", 4, c);
			stream.close(c);

			stream = obj.create_next_version();
			stream.write("testing rules", 13, c);
			stream.close(c);

			stream = obj.create_next_version();
			stream.write("testing sucks", 13, c);
			stream.close(c);
			*/
		}

		public void test_store() {
			var store = new Graph.Store("tests/data");

			var blob = new Graph.Blob(store);
			blob.set_contents_from_file("/tmp/foo");
			blob.write();
			
			stdout.printf("blob: %s\n", blob.uuid);

			var commit = new Graph.Commit(store);
			commit.blob = blob;
			commit.parents.append( new Graph.Commit.from_uuid(store, "some random uuid") );
			commit.author = "<NAME> <<EMAIL>>";
			commit.committer = "<NAME> <<EMAIL>>";
			commit.message = "Foo bar foo bar";
			commit.write();

			stdout.printf("commit: %s\n", commit.uuid);

			/* OK, lets try and read 'stuff' back. */
			var c = new Graph.Commit.from_uuid(store, commit.uuid);
			c.unserialize();

			assert( c.author == "<NAME> <<EMAIL>>" );
			assert( c.committer == "<NAME> <<EMAIL>>" );
			assert( c.message == "Foo bar foo bar" );
		}

		public void test_wizbit_2() {
			var obj = new Wiz.Object("SOMENAME");

			var v1 = obj.create_next_version_from_string("FOOBAR", null);
			var v2 = obj.create_next_version_from_string("BARFOO", v1);
		}

		public void test_wizbit_3() {
			var obj = new Wiz.Object("SOMENAME");
			
			var v2 = obj.primary_tip;
			assert( v2 != null );
			assert( v2.author != null );
			assert( v2.previous != null );

			var v1 = v2.previous;
			assert( v1.author != null);
			assert( v1.previous == null);
		}

		public void test_wizbit_4() {
			var store = new Wiz.Store("repo_uuid", "tests/data/wiz_4");
		}

		static int main(string[] args) {
			var test = new Test();
			test.test_store();
			test.test_wizbit_2();
			test.test_wizbit_3();
			return 0;
		}
	}
}<commit_msg>Store is used to create new objects<commit_after>using GLib;
using Wiz;
using Graph;

namespace Wiz {
	class Test : GLib.Object {
		public void test_wizbit_1() {
			/*
			GLib.Cancellable c;
			OutputStream stream;

			Object obj = new Object();

			stream = obj.create_next_version();
			stream.write("test", 4, c);
			stream.close(c);

			stream = obj.create_next_version();
			stream.write("testing rules", 13, c);
			stream.close(c);

			stream = obj.create_next_version();
			stream.write("testing sucks", 13, c);
			stream.close(c);
			*/
		}

		public void test_store() {
			var store = new Graph.Store("tests/data");

			var blob = new Graph.Blob(store);
			blob.set_contents_from_file("/tmp/foo");
			blob.write();
			
			stdout.printf("blob: %s\n", blob.uuid);

			var commit = new Graph.Commit(store);
			commit.blob = blob;
			commit.parents.append( new Graph.Commit.from_uuid(store, "some random uuid") );
			commit.author = "<NAME> <<EMAIL>>";
			commit.committer = "<NAME> <<EMAIL>>";
			commit.message = "Foo bar foo bar";
			commit.write();

			stdout.printf("commit: %s\n", commit.uuid);

			/* OK, lets try and read 'stuff' back. */
			var c = new Graph.Commit.from_uuid(store, commit.uuid);
			c.unserialize();

			assert( c.author == "<NAME> <<EMAIL>>" );
			assert( c.committer == "<NAME> <<EMAIL>>" );
			assert( c.message == "Foo bar foo bar" );
		}

		public void test_wizbit_2() {
			var obj = new Wiz.Object("SOMENAME");

			var v1 = obj.create_next_version_from_string("FOOBAR", null);
			var v2 = obj.create_next_version_from_string("BARFOO", v1);
		}

		public void test_wizbit_3() {
			var obj = new Wiz.Object("SOMENAME");
			
			var v2 = obj.primary_tip;
			assert( v2 != null );
			assert( v2.author != null );
			assert( v2.previous != null );

			var v1 = v2.previous;
			assert( v1.author != null);
			assert( v1.previous == null);
		}

		public void test_wizbit_4() {
			var store = new Wiz.Store("repo_uuid", "tests/data/wiz_4");
			var obj = store.create_object();
			assert( obj != null );
		}

		static int main(string[] args) {
			var test = new Test();
			test.test_store();
			test.test_wizbit_2();
			test.test_wizbit_3();
			return 0;
		}
	}
}
{'fraction_non_alphanumeric': 0.1643389199255121, 'fraction_numerical': 0.0111731843575419, 'mean_word_length': 3.2502472799208704, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '4908605', 'n_tokens_mistral': 1826, 'n_tokens_neox': 1536, 'n_words': 364}