MCPcopy
hub / github.com/dropbox/godropbox / TestConvertAssignRow

Function TestConvertAssignRow

database/sqltypes/sqltypes_test.go:336–379  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

334}
335
336func TestConvertAssignRow(t *testing.T) {
337 var err error
338
339 row := make([]Value, 4, 4)
340 row[0], err = BuildValue(int(123))
341 if err != nil {
342 t.Errorf("%v", err)
343 }
344 row[1], err = BuildValue(int64(-1))
345 if err != nil {
346 t.Errorf("%v", err)
347 }
348 row[2], err = BuildValue("abcd")
349 if err != nil {
350 t.Errorf("%v", err)
351 }
352
353 row[3], err = BuildValue([]byte("fdsa"))
354 if err != nil {
355 t.Errorf("%v", err)
356 }
357
358 var n32 int
359 var n64 int64
360 var str string
361 var buffer []byte
362
363 err = ConvertAssignRow(row, &n32, &n64, &str, &buffer)
364 if err != nil {
365 t.Errorf("%v", err)
366 }
367 if n32 != 123 {
368 t.Errorf("Expecting 123")
369 }
370 if n64 != -1 {
371 t.Errorf("Expecting -1")
372 }
373 if str != "abcd" {
374 t.Errorf("Expecting abcd")
375 }
376 if !bytes.Equal(buffer, []byte("fdsa")) {
377 t.Errorf("Expecting fdsa")
378 }
379}
380
381func TestConvertAssignRowLengthMismatch(t *testing.T) {
382 var err error

Callers

nothing calls this directly

Calls 2

BuildValueFunction · 0.85
ConvertAssignRowFunction · 0.85

Tested by

no test coverage detected