<commit_before>var createContext = require('./util/create-context')
var createREGL = require('../regl')
var tape = require('tape')

tape('buffer update', function (t) {
  var gl = createContext(2, 2)
  var regl = createREGL(gl)

  regl.clear({
    color: [0, 0, 0, 0],
    depth: 1
  })

  const data = regl.buffer()

  const draw = regl({
    vert: `
    precision highp float;
    attribute vec4 position;
    void main () {
      gl_Position = position;
    }
    `,

    frag: `
    void main () {
      gl_FragColor = vec4(1, 1, 1, 1);
    }
    `,

    attributes: {
      position: data
    },

    count: 3
  })

  data([
    [-4, 0, 0, 1],
    [4, -4, 0, 1],
    [4, 4, 0, 1]
  ])

  draw()

  t.same(
    Array.prototype.slice.call(regl.read()),
    [
      1, 1, 1, 1, 1, 1, 1, 1,
      1, 1, 1, 1, 1, 1, 1, 1
    ],
    'buffer update ok')

  regl.destroy()
  t.equals(gl.getError(), 0, 'error ok')
  createContext.destroy(gl)
  t.end()
})<commit_msg>fix test case, should expect 255<commit_after>var createContext = require('./util/create-context')
var createREGL = require('../regl')
var tape = require('tape')

tape('buffer update', function (t) {
  var gl = createContext(2, 2)
  var regl = createREGL(gl)

  regl.clear({
    color: [0, 0, 0, 0],
    depth: 1
  })

  const data = regl.buffer()

  const draw = regl({
    vert: `
    precision highp float;
    attribute vec4 position;
    void main () {
      gl_Position = position;
    }
    `,

    frag: `
    void main () {
      gl_FragColor = vec4(1, 1, 1, 1);
    }
    `,

    attributes: {
      position: data
    },

    count: 3
  })

  data([
    [-4, 0, 0, 1],
    [4, -4, 0, 1],
    [4, 4, 0, 1]
  ])

  draw()

  t.same(
    Array.prototype.slice.call(regl.read()),
    [
      255, 255, 255, 255, 255, 255, 255, 255,
      255, 255, 255, 255, 255, 255, 255, 255
    ],
    'buffer update ok')

  regl.destroy()
  t.equals(gl.getError(), 0, 'error ok')
  createContext.destroy(gl)
  t.end()
})
{'fraction_non_alphanumeric': 0.17450682852807284, 'fraction_numerical': 0.06120384420839656, 'mean_word_length': 2.1903225806451614, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4587634', 'n_tokens_mistral': 880, 'n_tokens_neox': 756, 'n_words': 205}