Something went wrong. Try again.
🌱 A minimal programming language and compiler. git.urbach.dev/cli/q
high-performance programming-language compiler
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237package tests_test
import ( "testing"
"git.urbach.dev/cli/q/src/config")
var tests = []run{ {"empty", nil, "", "", 0}, {"assert", nil, "", "1 == 0\n", 1}, {"binary", nil, "", "", 0}, {"octal", nil, "", "", 0}, {"hexadecimal", nil, "", "", 0}, {"rune", nil, "", "", 0}, {"variables", nil, "", "", 0}, {"reassign", nil, "", "", 0}, {"reuse", nil, "", "", 0}, {"return", nil, "", "", 0}, {"add", nil, "", "", 0}, {"sub", nil, "", "", 0}, {"mul", nil, "", "", 0}, {"div", nil, "", "", 0}, {"sum", nil, "", "", 0}, {"square-sum", nil, "", "", 0}, {"math", nil, "", "", 0}, {"bitwise-and", nil, "", "", 0}, {"bitwise-or", nil, "", "", 0}, {"bitwise-xor", nil, "", "", 0}, {"unsigned", nil, "", "", 0}, {"unsigned-comparison", nil, "", "", 0}, {"shift", nil, "", "", 0}, {"shift-register", nil, "", "", 0}, {"shift-sign", nil, "", "", 0}, {"shift-range", nil, "", "", 0}, {"modulo", nil, "", "", 0}, {"signed", nil, "", "", 0}, {"negation", nil, "", "", 0}, {"not", nil, "", "", 0}, {"assign", nil, "", "", 0}, {"limits", nil, "", "127\n-128\n32767\n-32768\n2147483647\n-2147483648\n9223372036854775807\n-9223372036854775808\n", 0}, {"overflow", nil, "", "", 0}, {"underflow", nil, "", "", 0}, {"param", nil, "", "", 0}, {"param-multi", nil, "", "", 0}, {"param-order", nil, "", "", 0}, {"branch", nil, "", "", 0}, {"branch-and", nil, "", "", 0}, {"branch-or", nil, "", "", 0}, {"branch-both", nil, "", "", 0}, {"bool", nil, "", "false\ntrue\nfalse\ntrue\nfalse\ntrue\ntrue\ntrue\n", 0}, {"bool-2", nil, "", "", 0}, {"jump-near", nil, "", "", 0}, {"reorder-blocks", nil, "", "CDFH\n", 0}, {"switch", nil, "", "", 0}, {"switch-expression", nil, "", "", 0}, {"phi", nil, "", "", 0}, {"phi-simple", nil, "", "", 0}, {"phi-advanced", nil, "", "", 0}, {"phi-reassign", nil, "", "", 0}, {"phi-reassign-output", nil, "", "12345", 0}, {"phi-clobber", nil, "", "3\n", 0}, {"phi-reassign-copy", nil, "", "", 0}, {"phi-move-cycle", nil, "", "0\n14\n0\n", 0}, {"phi-move-reorder", nil, "", "0\n14\n0\n", 0}, {"phi-dead", nil, "", "", 0}, {"min", nil, "", "", 0}, {"max", nil, "", "", 0}, {"hello", nil, "", "Hello\nHello\nHello\n", 0}, {"escape", nil, "", "a\tb\nc\td\n", 0}, {"script", nil, "", "Hello\n", 0}, {"loop-counter-tail", nil, "", "10\n9\n8\n7\n6\n5\n4\n3\n2\n1\n0\n", 0}, {"loop-counter-head", nil, "", "9\n8\n7\n6\n5\n4\n3\n2\n1\n0\n", 0}, {"loop-count", nil, "", "", 0}, {"loop-count-down", nil, "", "", 0}, {"loop-write", nil, "", "..........", 0}, {"loop-optimize-single-iterator", nil, "", "", 0}, {"loop-limit", nil, "", "", 0}, {"loop-keepalive-outside", nil, "", "", 0}, {"loop-keepalive-inside", nil, "", "", 0}, {"loop-copy-from", nil, "", "", 0}, {"loop-copy-until", nil, "", "", 0}, {"loop-modify-iterator", nil, "", "13579", 0}, {"loop-modify-limit", nil, "", "", 0}, {"loop-modify-struct", nil, "", "12345", 0}, {"loop-infinite-lifetime", nil, "", "", -1}, {"loop-next", nil, "", "0\n2\n4\n6\n8\n", 0}, {"loop-next-2", nil, "", "", 0}, {"loop-next-3", nil, "", "", 0}, {"loop-next-4", nil, "", "", 0}, {"loop-stop", nil, "", "", 0}, {"loop-stop-2", nil, "", "", 0}, {"loop-stop-3", nil, "", "f: 1", 0}, {"loop-combined", nil, "", "01678", 0}, {"loop-nested-xy", nil, "", "0,0\n0,1\n0,2\n1,0\n1,1\n1,2\n2,0\n2,1\n2,2\n", 0}, {"loop-nested-xyz", nil, "", "0,0,0\n0,0,1\n0,0,2\n0,1,0\n0,1,1\n0,1,2\n0,2,0\n0,2,1\n0,2,2\n1,0,0\n1,0,1\n1,0,2\n1,1,0\n1,1,1\n1,1,2\n1,2,0\n1,2,1\n1,2,2\n2,0,0\n2,0,1\n2,0,2\n2,1,0\n2,1,1\n2,1,2\n2,2,0\n2,2,1\n2,2,2\n", 0}, {"loop-nested-return", nil, "", "..........", 0}, {"loop-nested-modify", nil, "", "", 0}, {"commutativity", nil, "", "", 0}, {"factorial", nil, "", "", 0}, {"fibonacci", nil, "", "", 0}, {"memory", nil, "", "Hello\n", 0}, {"out-of-memory", nil, "", "(x as int) >= 0x1000\n", 1}, {"memory-growth", nil, "", "", 0}, {"index-static", nil, "", "", 0}, {"index-dynamic", nil, "", "", 0}, {"struct", nil, "", "", 0}, {"struct-pointer", nil, "", "", 0}, {"struct-pointer-init", nil, "", "", 0}, {"struct-return-pointer", nil, "", "", 0}, {"struct-return", nil, "", "", 0}, {"struct-copy", nil, "", "", 0}, {"struct-pointer-deref", nil, "", "", 0}, {"struct-modify-branch", nil, "", "", 0}, {"struct-field-branch", nil, "", "", 0}, {"struct-param-ignored", nil, "", "", 0}, {"struct-param-negative", nil, "", "", 0}, {"struct-param-negative-2", nil, "", "", 0}, {"struct-param-nested", nil, "", "", 0}, {"string-by-value", nil, "", "Hello\n", 0}, {"circle", nil, "", "", 0}, {"circle-pointer", nil, "", "", 0}, {"circle-field-pointer", nil, "", "", 0}, {"circle-pointer-field-pointer", nil, "", "", 0}, {"color-8", nil, "", "", 0}, {"color-16", nil, "", "", 0}, {"color-32", nil, "", "", 0}, {"color-64", nil, "", "", 0}, {"return-2", nil, "", "", 0}, {"return-3", nil, "", "", 0}, {"return-4", nil, "", "", 0}, {"return-bool", nil, "", "", 0}, {"return-string", nil, "", "Hello\n", 0}, {"return-tuple", nil, "", "", 0}, {"multi-define-assign", nil, "", "", 0}, {"ignore-error", nil, "", "", 0}, {"ignore-unused-field", nil, "", "", 0}, {"slice", nil, "", "Hello World", 0}, {"file-read", nil, "", "", 0}, {"strings-equal", nil, "", "", 0}, {"strings-equal-operator", nil, "", "", 0}, {"strings-index", nil, "", "", 0}, {"strings-cut", nil, "", "", 0}, {"strings-trim", nil, "", "", 0}, {"strings-prefix", nil, "", "", 0}, {"strings-suffix", nil, "", "", 0}, {"strings-concat", nil, "", "", 0}, {"strings-concat-operator", nil, "", "", 0}, {"strings-to-int", nil, "", "", 0}, {"reorder-add", nil, "", "", 0}, {"reorder-values", nil, "", "", 0}, {"free-registers", nil, "", "", 0}, {"overload", nil, "", "", 0}, {"resource", nil, "", "", 0}, {"function-pointer", nil, "", "", 0}, {"cast", nil, "", "", 0}, {"cast-deduplication", nil, "", "", 0}, {"cast-reorder", nil, "", "", 0}, {"cse-type", nil, "", "", 0}, {"array-assign", nil, "", "", 0}, {"array-int", nil, "", "", 0}, {"array-int-custom", nil, "", "", 0}, {"array-int-parameter", nil, "", "", 0}, {"array-int-fixed-offset", nil, "", "127\n128\n4095\n4096\n", 0}, {"array-struct", nil, "", "", 0}, {"array-struct-copy", nil, "", "", 0}, {"array-struct-copy-call", nil, "", "", 0}, {"array-string", nil, "", "HelloWorld", 0}, {"array-static", nil, "", "", 0}, {"array-static-global", nil, "", "", 0}, {"array-static-global-grid", nil, "", "", 0}, {"array-static-loop", nil, "", "", 0}, {"array-slice", nil, "", "", 0}, {"array-slice-call", nil, "", "", 0}, {"array-slice-nested", nil, "", "", 0}, {"signed-load-8", nil, "", "", 0}, {"signed-load-16", nil, "", "", 0}, {"signed-load-32", nil, "", "", 0}, {"signed-load-offset-8", nil, "", "", 0}, {"signed-load-offset-16", nil, "", "", 0}, {"signed-load-offset-32", nil, "", "", 0}, {"sort-0", nil, "", "", 0}, {"sort-1", nil, "", "", 0}, {"sort-2", nil, "", "", 0}, {"sort-3", nil, "", "", 0}, {"sort-4", nil, "", "", 0}, {"sort-8", nil, "", "", 0}, {"pointer-to-pointer", nil, "", "", 0}, {"stack-pointer", nil, "", "", 0}, {"const", nil, "", "", 0}, {"const-expr", nil, "", "", 0}, {"const-string", nil, "", "Hello", 0}, {"const-color", nil, "", "", 0}, {"global", nil, "", "", 0}, {"global-math", nil, "", "", 0}, {"c-length", nil, "", "", 0}, {"c-string", nil, "", "", 0}, {"cli-args", nil, "", "", 0}, {"cli-args", []string{"Hello"}, "", "Hello\n", 0}, {"cli-args", []string{"Hello", "World"}, "", "Hello\nWorld\n", 0}, {"cli-args", []string{"Hello", "世界"}, "", "Hello\n世界\n", 0}, {"cli-env", nil, "", "", 0}, {"cli-terminal", nil, "", "", 0}, {"method-local-int", nil, "", "42\n", 0}, {"method-local-string", nil, "", "Hello\n", 0}, {"method-local-overload", nil, "", "42\nHello\n", 0}, {"method-local-field", nil, "", "1\n2\n", 0}, {"method-local-struct", nil, "", "1\n2\n", 0}, {"method-local-struct-pointer", nil, "", "1\n2\n", 0}, {"method-local-parameters", nil, "", "", 0}, {"random", nil, "", "", 0}, {"sqrt", nil, "", "", 0}, {"fold", nil, "", "", 0}, {"fold-2", nil, "", "", 0}, {"enum", nil, "", "", 0}, {"cas", nil, "", "", 0}, {"mutex", nil, "", "", 0}, {"zero-alloc", nil, "", "", 0}, {"spill-call", nil, "", "", 0}, {"spill-call-binary", nil, "", "", 0}, {"spill-operands", nil, "", "70", 0}, {"spill-div-mod", nil, "", "256\n4096\n128\n672\n2688\n8592\n22912\n204\n3264\n102\n", 0}, {"spill-shift", nil, "", "", 0}, {"spill-loop-modify", nil, "", "", 0}, {"dead-value", nil, "", "", 0}, {"dead-value-load", nil, "", "", 0}, {"dead-value-orphan", nil, "", "", 0}, {"dead-value-call", nil, "", "", 0},}
func TestTests(t *testing.T) { for _, test := range tests { build := config.New(test.Name + ".q") build.Lint(false) test.Run(t, build) }}