<commit_before>using NUnit.Framework;

public sealed class TestObservable
{
	private sealed class Observer<T>
	{
		private T m_Value;

		public T value
		{
			get
			{
				return m_Value;
			}
		}

		public void OnChanged(T previousValue, T value)
		{
			m_Value = value;
		}
	}

	[Test]
	public void SetStringAndAppend()
	{
		Observable<string> state = new Observable<string>();
		Observer<string> observer = new Observer<string>();
		state.onChanged += observer.OnChanged;
		Assert.AreEqual(null, state.value);
		Assert.AreEqual(null, observer.value);
		state.value = "none";
		Assert.AreEqual("none", state.value);
		Assert.AreEqual("none", observer.value);
		state.value = "active";
		Assert.AreEqual("active", state.value);
		Assert.AreEqual("active", observer.value);

		state.value += "_begin";
		Assert.AreEqual("active_begin", state.value);
		Assert.AreEqual("active_begin", observer.value);
	}

	[Test]
	public void SetIntAndAddAndDivide()
	{
		Observable<int> state = new Observable<int>();
		Observer<int> observer = new Observer<int>();
		state.onChanged += observer.OnChanged;
		Assert.AreEqual(0, state.value);
		Assert.AreEqual(0, observer.value);
		state.value = 3;
		Assert.AreEqual(3, state.value);
		Assert.AreEqual(3, observer.value);
		state.value += 4;
		Assert.AreEqual(7, state.value);
		Assert.AreEqual(7, observer.value);

		state.value /= 3;
		Assert.AreEqual(2, state.value);
		Assert.AreEqual(2, observer.value);
	}

	[Test]
	public void SetBoolAndXor()
	{
		Observable<bool> state = new Observable<bool>();
		Observer<bool> observer = new Observer<bool>();
		state.onChanged += observer.OnChanged;
		Assert.AreEqual(false, state.value);
		Assert.AreEqual(false, observer.value);
		state.value = true;
		Assert.AreEqual(true, state.value);
		Assert.AreEqual(true, observer.value);
		state.value ^= true;
		Assert.AreEqual(false, state.value);
		Assert.AreEqual(false, observer.value);
	}
}<commit_msg>Test Observable: Rename imitator class.<commit_after>using NUnit.Framework;

public sealed class TestObservable
{
	private sealed class Imitator<T>
	{
		private T m_Value;

		public T value
		{
			get
			{
				return m_Value;
			}
		}

		public void OnChanged(T previousValue, T value)
		{
			m_Value = value;
		}
	}

	[Test]
	public void SetStringAndAppend()
	{
		Observable<string> state = new Observable<string>();
		Imitator<string> imitator = new Imitator<string>();
		state.onChanged += imitator.OnChanged;
		Assert.AreEqual(null, state.value);
		Assert.AreEqual(null, imitator.value);

		state.value = "none";
		Assert.AreEqual("none", state.value);
		Assert.AreEqual("none", imitator.value);
		state.value = "active";
		Assert.AreEqual("active", state.value);
		Assert.AreEqual("active", imitator.value);

		state.value += "_begin";
		Assert.AreEqual("active_begin", state.value);
		Assert.AreEqual("active_begin", imitator.value);
		state.onChanged -= imitator.OnChanged;
	}

	[Test]
	public void SetIntAndAddAndDivide()
	{
		Observable<int> state = new Observable<int>();
		Imitator<int> imitator = new Imitator<int>();
		state.onChanged += imitator.OnChanged;
		Assert.AreEqual(0, state.value);
		Assert.AreEqual(0, imitator.value);

		state.value = 3;
		Assert.AreEqual(3, state.value);
		Assert.AreEqual(3, imitator.value);

		state.value += 4;
		Assert.AreEqual(7, state.value);
		Assert.AreEqual(7, imitator.value);

		state.value /= 3;
		Assert.AreEqual(2, state.value);
		Assert.AreEqual(2, imitator.value);
		state.onChanged -= imitator.OnChanged;
	}

	[Test]
	public void SetBoolAndXor()
	{
		Observable<bool> state = new Observable<bool>();
		Imitator<bool> imitator = new Imitator<bool>();
		state.onChanged += imitator.OnChanged;
		Assert.AreEqual(false, state.value);
		Assert.AreEqual(false, imitator.value);

		state.value = true;
		Assert.AreEqual(true, state.value);
		Assert.AreEqual(true, imitator.value);

		state.value ^= true;
		Assert.AreEqual(false, state.value);
		Assert.AreEqual(false, imitator.value);
		state.onChanged -= imitator.OnChanged;
	}
}
{'fraction_non_alphanumeric': 0.14516932270916336, 'fraction_numerical': 0.005478087649402391, 'mean_word_length': 4.421052631578948, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '7033248', 'n_tokens_mistral': 1533, 'n_tokens_neox': 1383, 'n_words': 268}