<commit_before>"use strict";

// データの種類と特徴
// ========

var expect = require('expect.js');
var util = require('util');

// ## 型とは何か
describe('型とは何か', () => {
  it('整数の構成', (next) => {
    /* #@range_begin(integer_construction) */
    var succ = (n) => {
      return n + 1;
    };
    expect(
      succ(0)
    ).to.eql(
      1
    );
    expect(
      succ(succ(0))
    ).to.eql(
      2
    );
    /* #@range_end(integer_construction) */
    next();
  });
  /*
    describe('型決定のタイミング', () => {
    it('NaNはエラーの場所を発見しにくくする', (next) => {
    var one = 1;
    var two = 2;
    var three = "three";
    var four = 4;
    expect(
    one * two * (three + four)
    ).to.eql(
    11   // 1 * 2 + (3 + 4) = 10 を期待する
    );
    next();
    });
    })
  */
});
// ### 基本型
describe('基本型', () => {
  it('未定義の変数', (next) => {
    /* #@range_begin(undefined_variable) */
    var variable; // 宣言されているが値と結びついていない変数
    expect(
      variable
    ).to.eql(
      undefined
    );
    /* #@range_end(undefined_variable) */
    next();
  });
  it('真理値型は不変である', (next) => {
    /* #@range_begin(truth_is_immutable) */
    var truth = true;
    expect(
      ! truth
    ).to.eql(
      false
    );
    expect(
      truth
    ).to.eql(
      truth
    );
    /* #@range_end(truth_is_immutable) */
    next();
  });
  it('数値型は不変である', (next) => {
    /* #@range_begin(number_is_immutable) */
    expect(
      1
    ).to.eql(
      1
    );
    var one = 1;
    one = one + 1;
    expect(
      one
    ).to.eql(
      2
    );
    /* #@range_end(number_is_immutable) */
    next();
  });
  it('文字列は不変である', (next) => {
    /* #@range_begin(string_is_immutable) */
    var str = "to be, or not to be";
    expect(
      str.toUpperCase()
    ).to.eql(
      "TO BE, OR NOT TO BE"
    );
    expect(
      str
    ).to.eql(
      "to be, or not to be"
    );
    /* #@range_end(string_is_immutable)  */
    next();
  });
  it('==比較演算子', (next) => {
    /* #@range_begin(equality_operator) */
    expect(
      null == undefined
    ).to.eql(
      true
    );
    expect(
      false == ''
    ).to.eql(
      true
    );
    expect(
      true == '1'
    ).to.eql(
      true
    );
    expect(
      1 == '1'
    ).to.eql(
      true
    );
    /* #@range_end(equality_operator)  */
    next();
  });
});
// ### 合成型
describe('合成型', () => {
  // #### オブジェクト型
  describe('オブジェクト型', () => {
    describe('アドレス帳の例', () => {
      it('オブジェクトのインスタンスの例', (next) => {
        /* #@range_begin(object_instance_example) */
        var addressbook = {
          No1: "<NAME>",
          No2: "<NAME>ry",
          No3: "Alonzo Church",
          No4: "Ada Lovelace"
        };
        /* #@range_end(object_instance_example) */
        next();
      });
      it('オブジェクト型の入れ子', (next) => {
        /* ##@range_begin(object_can_embed_object) */
        var addressbook = {
          No1: {
            name: "<NAME>",
            gender: "male",
            birthDay: "1912/6/23"
          },
          No2: {
            name: "<NAME>",
            gender: "male",
            birthDay: "1900/9/12"
          },
          No3: {
            name: "<NAME>",
            gender: "male",
            birthDay: "1903/6/14"
          },
          No4: {
            name: "<NAME>",
            gender: "female",
            birthDay: "1815/12/10"
          }
        };
        /* ##@range_end(object_can_embed_object) */
        var addressbook_nested = {
          /* ##@range_begin(object_can_embed_object_nested) */
          No1: {
            name: "<NAME>",
            gender: "male",
            birthDay: {
              year: 1912,
              month: 6,
              day: 23
            }
          }
          /* ##@range_end(object_can_embed_object_nested) */
        };
        /* hasOwnPropertyでプロパティの有無を調べる */
        /* #@range_begin(object_access) */
        expect(
          addressbook.No1.name     // オブジェクト.キー記法
        ).to.eql(
          "<NAME>"
        );
        expect(
          addressbook["No1"]["name"]  // オブジェクト[キー]記法
        ).to.eql(
          "<NAME>"
        );
        /* #@range_end(object_access) */
        expect(
          addressbook.hasOwnProperty("No1")
        ).to.eql(
          true
        );
        expect(
          addressbook.hasOwnProperty("No9")
        ).to.eql(
          false
        );
        next();
      });
      it('オブジェクト型によるアドレス帳の表現', (next) => {
        /* #@range_begin(addressbook_example) */
        var addressbook = {
          BMI: (weight, height) => {<commit_msg>align<commit_after>"use strict";

// データの種類と特徴
// ========

var expect = require('expect.js');
var util = require('util');

// ## 型とは何か
describe('型とは何か', () => {
  it('整数の構成', (next) => {
    /* #@range_begin(integer_construction) */
    var succ = (n) => {
      return n + 1;
    };
    expect(
      succ(0)
    ).to.eql(
      1
    );
    expect(
      succ(succ(0))
    ).to.eql(
      2
    );
    /* #@range_end(integer_construction) */
    next();
  });
  /*
    describe('型決定のタイミング', () => {
    it('NaNはエラーの場所を発見しにくくする', (next) => {
    var one = 1;
    var two = 2;
    var three = "three";
    var four = 4;
    expect(
    one * two * (three + four)
    ).to.eql(
    11   // 1 * 2 + (3 + 4) = 10 を期待する
    );
    next();
    });
    })
  */
});
// ### 基本型
describe('基本型', () => {
  it('未定義の変数', (next) => {
    /* #@range_begin(undefined_variable) */
    var variable; // 宣言されているが値と結びついていない変数
    expect(
      variable
    ).to.eql(
      undefined
    );
    /* #@range_end(undefined_variable) */
    next();
  });
  it('真理値型は不変である', (next) => {
    /* #@range_begin(truth_is_immutable) */
    var truth = true;
    expect(
      ! truth
    ).to.eql(
      false
    );
    expect(
      truth
    ).to.eql(
      truth
    );
    /* #@range_end(truth_is_immutable) */
    next();
  });
  it('数値型は不変である', (next) => {
    /* #@range_begin(number_is_immutable) */
    expect(
      1
    ).to.eql(
      1
    );
    var one = 1;
    one = one + 1;
    expect(
      one
    ).to.eql(
      2
    );
    /* #@range_end(number_is_immutable) */
    next();
  });
  it('文字列は不変である', (next) => {
    /* #@range_begin(string_is_immutable) */
    var str = "to be, or not to be";
    expect(
      str.toUpperCase()
    ).to.eql(
      "TO BE, OR NOT TO BE"
    );
    expect(
      str
    ).to.eql(
      "to be, or not to be"
    );
    /* #@range_end(string_is_immutable)  */
    next();
  });
  it('==比較演算子', (next) => {
    /* #@range_begin(equality_operator) */
    expect(
      null == undefined
    ).to.eql(
      true
    );
    expect(
      false == ''
    ).to.eql(
      true
    );
    expect(
      true == '1'
    ).to.eql(
      true
    );
    expect(
      1 == '1'
    ).to.eql(
      true
    );
    /* #@range_end(equality_operator)  */
    next();
  });
});
// ### 合成型
describe('合成型', () => {
  // #### オブジェクト型
  describe('オブジェクト型', () => {
    describe('アドレス帳の例', () => {
      it('オブジェクトのインスタンスの例', (next) => {
        /* #@range_begin(object_instance_example) */
        var addressbook = {
          No1: "<NAME>",
          No2: "<NAME>",
          No3: "Alonzo Church",
          No4: "<NAME>"
        };
        /* #@range_end(object_instance_example) */
        next();
      });
      it('オブジェクト型の入れ子', (next) => {
        /* ##@range_begin(object_can_embed_object) */
        var addressbook = {
          No1: {
            name: "<NAME>",
            gender: "male",
            birthDay: "1912/6/23"
          },
          No2: {
            name: "<NAME>",
            gender: "male",
            birthDay: "1900/9/12"
          },
          No3: {
            name: "<NAME>",
            gender: "male",
            birthDay: "1903/6/14"
          },
          No4: {
            name: "<NAME>",
            gender: "female",
            birthDay: "1815/12/10"
          }
        };
        /* ##@range_end(object_can_embed_object) */
        var addressbook_nested = {
          /* ##@range_begin(object_can_embed_object_nested) */
          No1: {
            name: "<NAME>",
            gender: "male",
            birthDay: {
              year: 1912,
              month: 6,
              day: 23
            }
          }
          /* ##@range_end(object_can_embed_object_nested) */
        };
        /* hasOwnPropertyでプロパティの有無を調べる */
        /* #@range_begin(object_access) */
        expect(
          addressbook.No1.name        // オブジェクト.キー記法
        ).to.eql(
          "<NAME>"
        );
        expect(
          addressbook["No1"]["name"]  // オブジェクト[キー]記法
        ).to.eql(
          "<NAME>"
        );
        /* #@range_end(object_access) */
        expect(
          addressbook.hasOwnProperty("No1")
        ).to.eql(
          true
        );
        expect(
          addressbook.hasOwnProperty("No9")
        ).to.eql(
          false
        );
        next();
      });
      it('オブジェクト型によるアドレス帳の表現', (next) => {
        /* #@range_begin(addressbook_example) */
        var addressbook = {
          BMI: (weight, height) => {
{'fraction_non_alphanumeric': 0.1807295709058654, 'fraction_numerical': 0.016188047455371994, 'mean_word_length': 1.4597763839650941, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 58, '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': '3176170', 'n_tokens_mistral': 3519, 'n_tokens_neox': 3455, 'n_words': 529}