<commit_before>import assert from 'assert';
import Ixonet from '../lib';

describe('ixonet', function() {
  it('should have a head with value 1', () => {
    let ixonet = Ixonet();

    assert.equal(ixonet.head.value.curr, 1);
  });

  it('should still have head with value 1 after a step', () => {
    let ixonet = Ixonet();

    ixonet.step();

    assert.equal(ixonet.head.value.curr, 1);
  });

  it('should decay in propagation', () => {
    let ixonet = Ixonet();

    let head = ixonet.head;
    let a = ixonet.Ixon();
    let b = ixonet.Ixon();

    ixonet.connect(head, head, a);
    ixonet.connect(a, head, b);

    ixonet.step();

    assert.equal(a.value.curr, ixonet.decay);
    assert.equal(b.value.curr, 0);

    ixonet.step();

    assert.equal(a.value.curr, ixonet.decay);
    assert.equal(b.value.curr, ixonet.decay * ixonet.decay);
  });
});<commit_msg>Test state in propagation<commit_after>import assert from 'assert';
import Ixonet from '../lib';

describe('ixonet', function() {
  it('should have a head with value 1', () => {
    let ixonet = Ixonet();

    assert.equal(ixonet.head.value.curr, 1);
  });

  it('should still have head with value 1 after a step', () => {
    let ixonet = Ixonet();

    ixonet.step();

    assert.equal(ixonet.head.value.curr, 1);
  });

  it('should decay in propagation', () => {
    let ixonet = Ixonet();

    let head = ixonet.head;
    let a = ixonet.Ixon();
    let b = ixonet.Ixon();

    ixonet.connect(head, head, a);
    ixonet.connect(a, head, b);

    ixonet.step();

    assert.equal(a.value.curr, ixonet.decay);
    assert.equal(b.value.curr, 0);

    ixonet.step();

    assert.equal(a.value.curr, ixonet.decay);
    assert.equal(b.value.curr, ixonet.decay * ixonet.decay);
  });

  it('should have state that allows accumulation', () => {
    let ixonet = Ixonet();

    let head = ixonet.head;
    let a = ixonet.Ixon();
    ixonet.connect(head, head, a);
    ixonet.connect(a, head, a);

    assert.equal(a.value.curr, 0);

    let k = ixonet.decay;

    ixonet.step();
    assert.equal(a.value.curr, k);

    ixonet.step();
    assert.equal(a.value.curr, k + k * k);

    ixonet.step();
    assert.equal(a.value.curr, k + k * k + k * k * k);
  });
});
{'fraction_non_alphanumeric': 0.17863554757630162, 'fraction_numerical': 0.004937163375224416, 'mean_word_length': 2.843103448275862, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5645464', 'n_tokens_mistral': 930, 'n_tokens_neox': 791, 'n_words': 187}