...

Source file src/github.com/AdaLogics/go-fuzz-headers/sql_test.go

Documentation: github.com/AdaLogics/go-fuzz-headers

     1  // Copyright 2023 The go-fuzz-headers Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package gofuzzheaders
    16  
    17  import (
    18  	"testing"
    19  )
    20  
    21  func TestSQLAPI(t *testing.T) {
    22  	t.Run("Test 1", func(t *testing.T) {
    23  		data := []byte{1, 1, 0, 1}
    24  		f := NewConsumer(data)
    25  		query, err := f.GetSQLString()
    26  		if err != nil {
    27  			t.Error(err)
    28  		}
    29  		if query != " action" {
    30  			t.Errorf("expected ' action', got: '%s'", query)
    31  		}
    32  	})
    33  	t.Run("Test 2", func(t *testing.T) {
    34  		data := []byte{
    35  			222, 255, 0, 100, 10, 64, 2, 0, 0, 0,
    36  			0, 0, 0, 100, 6, 0, 0, 0, 0, 0, 0, 255,
    37  			61, 100, 170, 0, 0,
    38  		}
    39  		f := NewConsumer(data)
    40  		query, err := f.GetSQLString()
    41  		if err != nil {
    42  			t.Error(err)
    43  		}
    44  		t.Log(query)
    45  	})
    46  }
    47  

View as plain text