<commit_before><!doctype html>
<meta charset=utf-8>
<meta content="width=device-width,initial-scale=1" name=viewport>
<title>common webgl.js Tests</title>
<link href=../../common/css/core.css rel=stylesheet>
<style>canvas{display:none}</style>

<a href=../../index.htm>iterami</a>/<a href=../index.htm>Docs.htm</a>/Tests/<a href=../../common/js/webgl.js>common webgl.js</a>
<table class=center>
  <thead>
    <tr class=header>
      <td>Function
      <td>Args
      <td>Expected
      <td>Returned
      <td>Test
  <tbody id=results>
</table>

<script src=../../common/js/core.js></script>
<script src=../../common/js/webgl.js></script>
<script>
function repo_init(){
    core_repo_init({
      'keybinds': {
        32: {},
        67: {},
      },
      'title': 'Docs.htm',
      'ui': '<hr><div id=npc-talk></div><div id=npc-trade></div>',
    });
    webgl_level_load({
      'character': -1,
    });

    let tests = [
      {
        'args': {
          'id': 'test-character',
          'level': 5,
        },
        'expect': function(returned){
            return webgl_characters['test-character']['health-current'] === 100;
        },
        'function': 'webgl_character_init',
      },
      {
        'args': {
          'character': 'test-character',
          'damage': 23,
        },
        'expect': function(returned){
            return webgl_characters['test-character']['health-current'] === 77;
        },
        'function': 'webgl_character_damage',
      },
      {
        'args': void 0,
        'expect': -1,
        'function': 'webgl_character_level',
      },
      {
        'args': {
          'character': 'fake-character',
        },
        'expect': -2,
        'function': 'webgl_character_level',
      },
      {
        'args': {
          'character': 'test-character',
        },
        'expect': 5,
        'function': 'webgl_character_level',
      },
      {
        'args': {
          'green': 1,
        },
        'expect': function(returned){
            return webgl_properties['clearcolor-blue'] === 0
              && webgl_properties['clearcolor-green'] === 1
              && webgl_properties['clearcolor-red'] === 0;
        },
        'function': 'webgl_clearcolor_set',
      },
      {
        'args': void 0,
        'expect': [
          0,
          1,
          0,
        ],
        'function': 'webgl_normals',
      },
      {
        'args': {
          'rotate-z': 90,
        },
        'expect': [
          1,
          0,
          0,
        ],
        'function': 'webgl_normals',
      },
      {
        'args': {
          'vertices-length': 2,
        },
        'expect': [
          0,
          1,
          0,
          0,
          1,
          0,
        ],
        'function': 'webgl_normals',
      },
      {
        'args': {
          'x': 0,
          'y': 0,
        },
        'expect': [
          0,
          0,
          0,
          0,
        ],<commit_msg>fixed webgl.js testing<commit_after><!doctype html>
<meta charset=utf-8>
<meta content="width=device-width,initial-scale=1" name=viewport>
<title>common webgl.js Tests</title>
<link href=../../common/css/core.css rel=stylesheet>
<style>canvas{display:none}</style>

<a href=../../index.htm>iterami</a>/<a href=../index.htm>Docs.htm</a>/Tests/<a href=../../common/js/webgl.js>common webgl.js</a>
<table class=center>
  <thead>
    <tr class=header>
      <td>Function
      <td>Args
      <td>Expected
      <td>Returned
      <td>Test
  <tbody id=results>
</table>

<script src=../../common/js/core.js></script>
<script src=../../common/js/webgl.js></script>
<script>
function repo_init(){
    core_repo_init({
      'keybinds': {
        32: {},
        67: {},
      },
      'title': 'Docs.htm',
      'ui': '<hr><div id=npc-talk></div><div id=npc-trade></div>',
    });
    webgl_level_load({
      'character': -1,
    });
    webgl_character_init({
      'id': 'test-character-0',
    });

    let tests = [
      {
        'args': {
          'id': 'test-character-1',
          'level': 5,
        },
        'expect': function(returned){
            return webgl_characters['test-character-1']['health-current'] === 100;
        },
        'function': 'webgl_character_init',
      },
      {
        'args': void 0,
        'expect': -1,
        'function': 'webgl_character_level',
      },
      {
        'args': {
          'character': 'fake-character',
        },
        'expect': -2,
        'function': 'webgl_character_level',
      },
      {
        'args': {
          'character': 'test-character-1',
        },
        'expect': 5,
        'function': 'webgl_character_level',
      },
      {
        'args': {
          'green': 1,
        },
        'expect': function(returned){
            return webgl_properties['clearcolor-blue'] === 0
              && webgl_properties['clearcolor-green'] === 1
              && webgl_properties['clearcolor-red'] === 0;
        },
        'function': 'webgl_clearcolor_set',
      },
      {
        'args': {
          'entity': webgl_characters['test-character-0'],
        },
        'expect': [
          0,
          1,
          0,
        ],
        'function': 'webgl_normals',
      },
      {
        'args': {
          'x': 0,
          'y': 0,
        },
        'expect': [
          0,
          0,
          0,
          0,
        ],
{'fraction_non_alphanumeric': 0.1862453531598513, 'fraction_numerical': 0.01449814126394052, 'mean_word_length': 1.5562945368171022, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 71, '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': '6928209', 'n_tokens_mistral': 1801, 'n_tokens_neox': 1748, 'n_words': 278}