<commit_before>require 'spec_helper'

describe KVDAG::Vertex do
  context 'immediate ancestry' do
    before :all do
      # v1 --> v2 --> v3
      #           \-> v4

      @dag = KVDAG.new
      @v1 = @dag.vertex

      @v2 = @dag.vertex
      @v1.edge @v2

      @v3 = @dag.vertex
      @v4 = @dag.vertex
      @v2.edge @v3
      @v2.edge @v4
    end

    it 'finds parents' do
      parents = @v2.parents
      expect(parents).not_to include @v1
      expect(parents).not_to include @v2
      expect(parents).to include @v3
      expect(parents).to include @v4
    end

    it 'finds children' do<commit_msg>Include attrnode examples in Vertex specs<commit_after>require 'spec_helper'
require 'attrnode_examples'

describe KVDAG::Vertex do
  include_examples 'attributenodes', lambda {
    @dag = KVDAG.new
    @dag.vertex
  }

  context 'immediate ancestry' do
    before :all do
      # v1 --> v2 --> v3
      #           \-> v4

      @dag = KVDAG.new
      @v1 = @dag.vertex

      @v2 = @dag.vertex
      @v1.edge @v2

      @v3 = @dag.vertex
      @v4 = @dag.vertex
      @v2.edge @v3
      @v2.edge @v4
    end

    it 'finds parents' do
      parents = @v2.parents
      expect(parents).not_to include @v1
      expect(parents).not_to include @v2
      expect(parents).to include @v3
      expect(parents).to include @v4
    end

    it 'finds children' do
{'fraction_non_alphanumeric': 0.11403508771929824, 'fraction_numerical': 0.027777777777777776, 'mean_word_length': 1.9890829694323144, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1972388', 'n_tokens_mistral': 502, 'n_tokens_neox': 483, 'n_words': 124}