<commit_before>'use strict';

describe("New Fraction creation", function () {
  var Fraction = require('../../lib/fractions/Fraction');

  // better names!
  describe("Init with 1/2", function () {
    var f;
    beforeEach(function () {
      f = new Fraction(1, 2);
    });

    it("should return 1 as nominator", function () {
      expect(f.nominator()).toEqual(1);
    });

    it("should return 2 as denominator", function () {
      expect(f.denominator()).toEqual(2);
    });
  });

  describe("Init with 3/4", function () {
    var f;
    beforeEach(function () {
      f = new Fraction(3, 4);
    });

    it("should return 3 as nominator", function () {
      expect(f.nominator()).toEqual(3);
    });

    it("should return 4 as denominator", function () {
      expect(f.denominator()).toEqual(4);
    });
  });

  describe("Fraction Addition", function () {
    describe("Nominator is 0", function () {
      var sum;
      beforeEach(function () {
        var f = new Fraction(0, 1);
        var f2 = new Fraction(0, 1);
        sum = f.add(f2);
      });

      it("should return 0 as nominator", function () {
        expect(sum.nominator()).toEqual(0);
      });
      it("should return 1 (from first fraction) as denominator", function () {
        expect(sum.denominator()).toEqual(1);
      });
    });

    describe("Same Denominator", function () {
      var sum;
      beforeEach(function () {
        var f = new Fraction(1, 1);
        var f2 = new Fraction(1, 1);
        sum = f.add(f2);
      });

      it("should return addition", function () {
        expect(sum.nominator()).toEqual(2);
        expect(sum.denominator()).toEqual(1);
      });
    });


    describe("Same Denominator", function () {
      var sum;
      beforeEach(function () {
        var f = new Fraction(1, 4);
        var f2 = new Fraction(2, 4);
        sum = f.add(f2);
      });

      it("should return addition.", function () {
        expect(sum.nominator()).toEqual(3);
        expect(sum.denominator()).toEqual(4);
      });
    });

    describe("Expand Denominator", function () {
      it("should expand 2nd denominator.", function () {
        var sum = new Fraction(1, 6).add(new Fraction(2, 3));
        expect(sum.nominator()).toEqual(5);
        expect(sum.denominator()).toEqual(6);
      });

      it("should expand 2nd denominator.", function () {
        var sum = new Fraction(1, 8).add(new Fraction(3, 4));
        expect(sum.nominator()).toEqual(7);
        expect(sum.denominator()).toEqual(8);
      });


      it("should expand 1st denominator.", function () {
        var sum = new Fraction(2, 3).add(new Fraction(1, 6));
        expect(sum.nominator()).toEqual(5);
        expect(sum.denominator()).toEqual(6);
      });
    });

  });
});



// TODO LIST
        // 1/6 + 2/3 = 5/6    1st denominator expansion
        // 2/3 + 1/6 = 5/6    2nd denominator expansion
        // 1/4 + 2/4 = 3/4    same denominator
        // 1/3 + 2/3 = 3/3    result full number
        // 1/2 + 1/3 = 5/6    
        // 7/3 + 4/5 = 47/15  complex example, no simplification
        // 3/3 + 4/4 = ??     whole numbers, expressed as fraction
        // 3 + 4 = 7          whole integers  
        // 5/2 +           
        // 1/3 + 1/2 = 5/6    denominator expansion
        // 1/0 ??             Error - 0 division
        // 2 1/2 ??           Error - not allowed


<commit_msg>added 2nd example pinning test<commit_after>'use strict';

describe("New Fraction creation", function () {
  var Fraction = require('../../lib/fractions/Fraction');

  // better names!
  describe("Init with 1/2", function () {
    var f;
    beforeEach(function () {
      f = new Fraction(1, 2);
    });

    it("should return 1 as nominator", function () {
      expect(f.nominator()).toEqual(1);
    });

    it("should return 2 as denominator", function () {
      expect(f.denominator()).toEqual(2);
    });
  });

  describe("Init with 3/4", function () {
    var f;
    beforeEach(function () {
      f = new Fraction(3, 4);
    });

    it("should return 3 as nominator", function () {
      expect(f.nominator()).toEqual(3);
    });

    it("should return 4 as denominator", function () {
      expect(f.denominator()).toEqual(4);
    });
  });

  describe("Fraction Addition", function () {
    describe("Nominator is 0", function () {
      var sum;
      beforeEach(function () {
        var f = new Fraction(0, 1);
        var f2 = new Fraction(0, 1);
        sum = f.add(f2);
      });

      it("should return 0 as nominator", function () {
        expect(sum.nominator()).toEqual(0);
      });
      it("should return 1 (from first fraction) as denominator", function () {
        expect(sum.denominator()).toEqual(1);
      });
    });

    describe("Same Denominator", function () {
      var sum;
      beforeEach(function () {
        var f = new Fraction(1, 1);
        var f2 = new Fraction(1, 1);
        sum = f.add(f2);
      });

      it("should return addition", function () {
        expect(sum.nominator()).toEqual(2);
        expect(sum.denominator()).toEqual(1);
      });
    });


    describe("Same Denominator", function () {
      var sum;
      beforeEach(function () {
        var f = new Fraction(1, 4);
        var f2 = new Fraction(2, 4);
        sum = f.add(f2);
      });

      it("should return addition.", function () {
        expect(sum.nominator()).toEqual(3);
        expect(sum.denominator()).toEqual(4);
      });
    });

    describe("Expand Denominator", function () {
      it("should expand 2nd denominator.", function () {
        var sum = new Fraction(1, 6).add(new Fraction(2, 3));
        expect(sum.nominator()).toEqual(5);
        expect(sum.denominator()).toEqual(6);
      });

      it("should expand 2nd denominator.", function () {
        var sum = new Fraction(1, 8).add(new Fraction(3, 4));
        expect(sum.nominator()).toEqual(7);
        expect(sum.denominator()).toEqual(8);
      });


      it("should expand 1st denominator.", function () {
        var sum = new Fraction(2, 3).add(new Fraction(1, 6));
        expect(sum.nominator()).toEqual(5);
        expect(sum.denominator()).toEqual(6);
      });
      
       it("should expand 1st denominator.", function () {
        var sum = new Fraction(3, 4).add(new Fraction(1, 8));
        expect(sum.nominator()).toEqual(7);
        expect(sum.denominator()).toEqual(8);
      });
    });

  });
});



// TODO LIST
        // 1/6 + 2/3 = 5/6    1st denominator expansion
        // 2/3 + 1/6 = 5/6    2nd denominator expansion
        // 1/4 + 2/4 = 3/4    same denominator
        // 1/3 + 2/3 = 3/3    result full number
        // 1/2 + 1/3 = 5/6    
        // 7/3 + 4/5 = 47/15  complex example, no simplification
        // 3/3 + 4/4 = ??     whole numbers, expressed as fraction
        // 3 + 4 = 7          whole integers  
        // 5/2 +           
        // 1/3 + 1/2 = 5/6    denominator expansion
        // 1/0 ??             Error - 0 division
        // 2 1/2 ??           Error - not allowed



{'fraction_non_alphanumeric': 0.1685584562996595, 'fraction_numerical': 0.036606129398410896, 'mean_word_length': 1.9805496828752642, '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': '3722507', 'n_tokens_mistral': 2342, 'n_tokens_neox': 2200, 'n_words': 528}