<commit_before>package parser

import (
	"fmt"
	"reflect"
	"strings"
)

func (this *EvalJade) registerStandardFunctions() {

	registerFunction(this.builtin, "len", length)
	registerFunction(this.builtin, "upper", upper)
	registerFunction(this.builtin, "lower", lower)
	registerFunction(this.builtin, "format", format)
}

func length(value interface{}) int {
	rvalue := reflect.ValueOf(value)
	return rvalue.Len()
}

func upper(txt string) string {
	return strings.ToUpper(txt)
}

func lower(txt string) string {
	return strings.ToLower(txt)
}

func format(txt string, args ...interface{}) string {
	return fmt.Sprintf(txt, args...)
}
<commit_msg>added tests for builtin functions<commit_after>package parser

import (
	"fmt"
	"reflect"
	"strings"
)

func (this *EvalJade) registerStandardFunctions() {

	registerFunction(this.builtin, "len", length)
	registerFunction(this.builtin, "upper", upper)
	registerFunction(this.builtin, "lower", lower)
	registerFunction(this.builtin, "format", format)
	registerFunction(this.builtin, "isnull", isnull)
}

func length(value interface{}) int {
	rvalue := reflect.ValueOf(value)
	return rvalue.Len()
}

func upper(txt string) string {
	return strings.ToUpper(txt)
}

func lower(txt string) string {
	return strings.ToLower(txt)
}

func format(txt string, args ...interface{}) string {
	return fmt.Sprintf(txt, args...)
}

func isnull(value, result interface{}) interface{} {
	if value == nil {
		return result
	}
	return value
}

{'fraction_non_alphanumeric': 0.13741496598639455, 'fraction_numerical': 0.0, 'mean_word_length': 5.423580786026201, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6393247', 'n_tokens_mistral': 475, 'n_tokens_neox': 480, 'n_words': 121}