<commit_before>#
# Copyright (C) 2007 <NAME> <<EMAIL>>
#
# This program is distributed under the terms of the MIT license.
# See the included MIT-LICENSE file for the terms of this license.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

require 'opengl/test_case'

class TestGl14 < OpenGL::TestCase

  def setup
    super

    supported? 1.4
  end

  def test_arrays_2
    sc = [0, 1, 0, 1, 0, 1].pack("f*")
    fc = [1, 0].pack("f*")

    glSecondaryColorPointer(3, GL_FLOAT, 0, sc)
    assert_equal 3,        glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_SIZE)
    assert_equal GL_FLOAT, glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_TYPE)
    assert_equal 12,       glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_STRIDE)
    assert_equal sc,       glGetPointerv(GL_SECONDARY_COLOR_ARRAY_POINTER)

    glFogCoordPointer(GL_FLOAT, 0, fc)
    assert_equal GL_FLOAT, glGetIntegerv(GL_FOG_COORD_ARRAY_TYPE)
    assert_equal 4,        glGetIntegerv(GL_FOG_COORD_ARRAY_STRIDE)
    assert_equal fc,       glGetPointerv(GL_FOG_COORD_ARRAY_POINTER)

    glEnableClientState(GL_SECONDARY_COLOR_ARRAY)
    glEnableClientState(GL_FOG_COORD_ARRAY)

    glBegin(GL_TRIANGLES)
    glArrayElement(0)
    glEnd()

    assert_equal([0, 1, 0, 1], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
    assert_equal(1, glGetDoublev(GL_CURRENT_FOG_COORD))

    glBegin(GL_TRIANGLES)
    glArrayElement(1)
    glEnd()

    assert_equal([1, 0, 1, 1], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
    assert_equal(0, glGetDoublev(GL_CURRENT_FOG_COORD))

    glDisableClientState(GL_SECONDARY_COLOR_ARRAY)
    glDisableClientState(GL_FOG_COORD_ARRAY)
  end

  def test_arrays_3
    va = [0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1].pack("f*")
    glVertexPointer(2, GL_FLOAT, 0, va)

    glEnableClientState(GL_VERTEX_ARRAY)
<commit_msg>make test_gl_14 pass.<commit_after>#
# Copyright (C) 2007 <NAME> <<EMAIL>>
#
# This program is distributed under the terms of the MIT license.
# See the included MIT-LICENSE file for the terms of this license.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

require 'opengl/test_case'

class TestGl14 < OpenGL::TestCase

  def setup
    super

    supported? 1.4
  end

  def test_arrays_2
    sc = [0, 1, 0, 1, 0, 1].pack("f*")
    fc = [1, 0].pack("f*")

    glSecondaryColorPointer(3, GL_FLOAT, 12, sc)
    assert_equal 3,        glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_SIZE)
    assert_equal GL_FLOAT, glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_TYPE)
    assert_equal 12,       glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_STRIDE)
    assert_equal sc,       glGetPointerv(GL_SECONDARY_COLOR_ARRAY_POINTER)

    glFogCoordPointer(GL_FLOAT, 4, fc)
    assert_equal GL_FLOAT, glGetIntegerv(GL_FOG_COORD_ARRAY_TYPE)
    assert_equal 4,        glGetIntegerv(GL_FOG_COORD_ARRAY_STRIDE)
    assert_equal fc,       glGetPointerv(GL_FOG_COORD_ARRAY_POINTER)

    glEnableClientState(GL_SECONDARY_COLOR_ARRAY)
    glEnableClientState(GL_FOG_COORD_ARRAY)

    glBegin(GL_TRIANGLES)
    glArrayElement(0)
    glEnd()

    assert_equal([0, 1, 0, 1], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
    assert_equal(1, glGetDoublev(GL_CURRENT_FOG_COORD))

    glBegin(GL_TRIANGLES)
    glArrayElement(1)
    glEnd()

    assert_equal([1, 0, 1, 1], glGetDoublev(GL_CURRENT_SECONDARY_COLOR))
    assert_equal(0, glGetDoublev(GL_CURRENT_FOG_COORD))

    glDisableClientState(GL_SECONDARY_COLOR_ARRAY)
    glDisableClientState(GL_FOG_COORD_ARRAY)
  end

  def test_arrays_3
    va = [0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1].pack("f*")
    glVertexPointer(2, GL_FLOAT, 0, va)

    glEnableClientState(GL_VERTEX_ARRAY)

{'fraction_non_alphanumeric': 0.08169269065399412, 'fraction_numerical': 0.02376103190767142, 'mean_word_length': 4.443349753694581, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '7014443', 'n_tokens_mistral': 1689, 'n_tokens_neox': 1564, 'n_words': 402}