<commit_before>package sqlego

import (
	s "strings"
	"testing"
)

func TestSelectStatement(t *testing.T) {
	node := Select("Users", []string{"id", "name", "email"})
	sql := node.Compile()
	if sql != "SELECT id,name,email FROM Users;" {
		t.Fatal(sql)
	}
}

func TestInsertStatement(t *testing.T) {
	node := Insert("Users", map[string]string{"name": "Bruce"})
	sql := node.Compile()
	if sql != "INSERT INTO Users (name) VALUES (Bruce);" {
		t.Fatal(sql)
	}
}

func TestUpdateStatement(t *testing.T) {
	node := Update("Users", map[string]string{"id": "2", "name": "Bruce", "email": "<EMAIL>"})
	sql := node.Compile()
	if !s.Contains(sql, "UPDATE Users SET") && !s.Contains(sql, "id=2") && !s.Contains(sql, "name=Bruce") && !s.Contains(sql, "email=<EMAIL>") {
		t.Fatal(sql)
	}
}

func TestDeleteStatement(t *testing.T) {
	node := Delete("Users")
	sql := node.Compile()<commit_msg>Add basic SELECT statement with WHERE testing<commit_after>package sqlego

import (
	s "strings"
	"testing"
)

func TestSelectStatement(t *testing.T) {
	node := Select("Users", []string{"id", "name", "email"})
	sql := node.Compile()
	if sql != "SELECT id,name,email FROM Users;" {
		t.Fatal(sql)
	}
}

func TestSelectStatementWithWhere(t *testing.T) {
	node := Select("Users", []string{"id", "name", "email"})
	node.Where(Gte("id", "10"))
	sql := node.Compile()
	if sql != "SELECT id,name,email FROM Users WHERE id>=10;" {
		t.Fatalf("Single condition:\n%s", sql)
	}
}

func TestInsertStatement(t *testing.T) {
	node := Insert("Users", map[string]string{"name": "Bruce"})
	sql := node.Compile()
	if sql != "INSERT INTO Users (name) VALUES (Bruce);" {
		t.Fatal(sql)
	}
}

func TestUpdateStatement(t *testing.T) {
	node := Update("Users", map[string]string{"id": "2", "name": "Bruce", "email": "<EMAIL>"})
	sql := node.Compile()
	if !s.Contains(sql, "UPDATE Users SET") && !s.Contains(sql, "id=2") && !s.Contains(sql, "name=Bruce") && !s.Contains(sql, "email=<EMAIL>") {
		t.Fatal(sql)
	}
}

func TestDeleteStatement(t *testing.T) {
	node := Delete("Users")
	sql := node.Compile()
{'fraction_non_alphanumeric': 0.21671525753158405, 'fraction_numerical': 0.003887269193391642, 'mean_word_length': 5.164670658682635, 'pattern_counts': {'":': 8, '<': 7, '<?xml version=': 0, '>': 8, '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': '2679761', 'n_tokens_mistral': 806, 'n_tokens_neox': 766, 'n_words': 174}