<commit_before>package test;

import static org.junit.Assert.*;

import java.math.BigDecimal;

import org.junit.Test;

import database.DBSet;

public class DatabaseTests {

	@Test
	public void databaseFork() {
		// Create in-memory DB
		DBSet databaseSet = DBSet.createEmptyDatabaseSet();

		// Create fork
		DBSet fork = databaseSet.fork();

		// TEST CHANGE TO MAIN DB INHERITED BY FORK (when no forked value exists)
		
		// Set balance in main DB
		databaseSet.getBalanceMap().set("test", BigDecimal.ONE);

		// Check balance in main DB
		assertEquals(BigDecimal.ONE, databaseSet.getBalanceMap().get("test"));

		// Check balance in fork
		assertEquals(BigDecimal.ONE, fork.getBalanceMap().get("test"));

		// TEST CHANGE IN FORK DOESN'T BACK-PROPAGATE TO MAIN DB
		
		// Set balance in fork
		fork.getBalanceMap().set("test", BigDecimal.TEN);

		// Check balance in main DB
		assertEquals(BigDecimal.ONE, databaseSet.getBalanceMap().get("test"));

		// Check balance in fork
		assertEquals(BigDecimal.TEN, fork.getBalanceMap().get("test"));

		// TEST NESTED FORKS
		
		// Create 2nd fork of 1st fork
		DBSet fork2 = fork.fork();

		// Set balance in 2nd fork
		fork2.getBalanceMap().set("test", BigDecimal.ZERO);

		// Check balance in main DB
		assertEquals(BigDecimal.ONE, databaseSet.getBalanceMap().get("test"));

		// Check balance in 1st fork
		assertEquals(BigDecimal.TEN, fork.getBalanceMap().get("test"));

		// Check balance in 2nd fork
		assertEquals(BigDecimal.ZERO, fork2.getBalanceMap().get("test"));
		
		// TEST CHANGE TO MAIN DB DOESN'T PROPAGATES TO ALL FORKS
		<commit_msg>fixed typo in DatabaseTests during last commit<commit_after>package test;

import static org.junit.Assert.*;

import java.math.BigDecimal;

import org.junit.Test;

import database.DBSet;

public class DatabaseTests {

	@Test
	public void databaseFork() {
		// Create in-memory DB
		DBSet databaseSet = DBSet.createEmptyDatabaseSet();

		// Create fork
		DBSet fork = databaseSet.fork();

		// TEST CHANGE TO MAIN DB INHERITED BY FORK (when no forked value exists)
		
		// Set balance in main DB
		databaseSet.getBalanceMap().set("test", BigDecimal.ONE);

		// Check balance in main DB
		assertEquals(BigDecimal.ONE, databaseSet.getBalanceMap().get("test"));

		// Check balance in fork
		assertEquals(BigDecimal.ONE, fork.getBalanceMap().get("test"));

		// TEST CHANGE IN FORK DOESN'T BACK-PROPAGATE TO MAIN DB
		
		// Set balance in fork
		fork.getBalanceMap().set("test", BigDecimal.TEN);

		// Check balance in main DB
		assertEquals(BigDecimal.ONE, databaseSet.getBalanceMap().get("test"));

		// Check balance in fork
		assertEquals(BigDecimal.TEN, fork.getBalanceMap().get("test"));

		// TEST NESTED FORKS
		
		// Create 2nd fork of 1st fork
		DBSet fork2 = fork.fork();

		// Set balance in 2nd fork
		fork2.getBalanceMap().set("test", BigDecimal.ZERO);

		// Check balance in main DB
		assertEquals(BigDecimal.ONE, databaseSet.getBalanceMap().get("test"));

		// Check balance in 1st fork
		assertEquals(BigDecimal.TEN, fork.getBalanceMap().get("test"));

		// Check balance in 2nd fork
		assertEquals(BigDecimal.ZERO, fork2.getBalanceMap().get("test"));
		
		// TEST CHANGE TO MAIN DB DOESN'T PROPAGATE TO ALL FORKS
		
{'fraction_non_alphanumeric': 0.12461252324860508, 'fraction_numerical': 0.0049597024178549285, 'mean_word_length': 3.7949479940564634, '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': '2953388', 'n_tokens_mistral': 1116, 'n_tokens_neox': 1005, 'n_words': 286}