<commit_before><?php

include_once(__DIR__ . '/../underscore.php');

class UnderscoreUtilityTest extends PHPUnit_Framework_TestCase {
  
  public function testIdentity() {
    // from js
    $moe = array('name'=>'moe');
    $moe_obj = (object) $moe;
    $this->assertEquals($moe, _::identity($moe));
    $this->assertEquals($moe_obj, _::identity($moe_obj));
  }
  
  public function testUniqueId() {
    // from js
    $ids = array();
    while($i++ < 100) array_push($ids, _::uniqueId());<commit_msg>Added OO test for identity()<commit_after><?php

include_once(__DIR__ . '/../underscore.php');

class UnderscoreUtilityTest extends PHPUnit_Framework_TestCase {
  
  public function testIdentity() {
    // from js
    $moe = array('name'=>'moe');
    $moe_obj = (object) $moe;
    $this->assertEquals($moe, _::identity($moe));
    $this->assertEquals($moe_obj, _::identity($moe_obj));
    
    // extra
    $this->assertEquals($moe, _($moe)->identity());
    $this->assertEquals($moe_obj, _($moe_obj)->identity());
  }
  
  public function testUniqueId() {
    // from js
    $ids = array();
    while($i++ < 100) array_push($ids, _::uniqueId());
{'fraction_non_alphanumeric': 0.18831734960767219, 'fraction_numerical': 0.0052310374891020054, 'mean_word_length': 3.905982905982906, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '3997411', 'n_tokens_mistral': 395, 'n_tokens_neox': 392, 'n_words': 72}