Fixed baking the right integer types into values from #ctce, added the rest of the integer type literals (10ul, etc), fixed/added struct padding/alignment in interpreter

This commit is contained in:
Nathan Braswell
2016-07-09 00:45:40 -07:00
parent dc5fe39083
commit ddd250e7f3
7 changed files with 204 additions and 43 deletions

View File

@@ -1,3 +1,8 @@
=====During CTCE!=====
3
hello, world
From Shell
@@ -12,3 +17,37 @@ From Shell
From Shell
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true

View File

@@ -3,6 +3,53 @@ import os: *
import string: *
import ast_nodes: *
obj first {
var p1: *char
var p2: char
var p3: int
}
obj second {
var p1: *char
var p2: char
var p3: short
}
obj third {
var p1: *char
var p2: long
var p3: char
}
obj fourth {
var p1: char
var p2: *char
var p3: long
}
obj fifth {
var p1: *char
var p2: char
}
obj sixth {
var p1: *char
var p2: char
var p3: long
}
obj seventh {
var p1: char
var p2: *char
var p3: long
}
obj eigth {
var p1: short
var p2: char
}
obj ninth {
var p1: *char
var p2: short
}
obj tenth {
var p1: char
var p2: ninth
}
fun compare_sizes<T>() {
var a = #sizeof<T>
var b = #ctce(#sizeof<T>)
@@ -22,7 +69,42 @@ fun main(): int {
return it.toCharArray()
}()))
}
compare_sizes<first>()
compare_sizes<second>()
compare_sizes<third>()
compare_sizes<fourth>()
compare_sizes<fifth>()
compare_sizes<sixth>()
compare_sizes<seventh>()
compare_sizes<eigth>()
compare_sizes<ninth>()
compare_sizes<tenth>()
compare_sizes<string>()
compare_sizes<ast_node>()
compare_sizes<translation_unit>()
compare_sizes<import>()
compare_sizes<identifier>()
compare_sizes<type_def>()
compare_sizes<adt_def>()
compare_sizes<function>()
compare_sizes<template>()
compare_sizes<code_block>()
compare_sizes<if_statement>()
compare_sizes<match_statement>()
compare_sizes<case_statement>()
compare_sizes<while_loop>()
compare_sizes<for_loop>()
compare_sizes<return_statement>()
compare_sizes<branching_statement>()
compare_sizes<defer_statement>()
compare_sizes<assignment_statement>()
compare_sizes<declaration_statement>()
compare_sizes<if_comp>()
compare_sizes<simple_passthrough>()
compare_sizes<function_call>()
compare_sizes<compiler_intrinsic>()
compare_sizes<cast>()
compare_sizes<value>()
return 0
}

View File

@@ -27,10 +27,10 @@ fun main(argc: int, argv: **char): int {
for (var i = 1; i < argc; i++;) {
var test_name = string(argv[i])
println(string("Doing test for ") + test_name)
if (system(kraken_path + " " + test_name + ".krak")) error("could not compile")
var results_file_name = test_name + ".results"
var expected_results_file_name = test_name + ".expected_results"
if (system(string("./") + test_name + " > " + results_file_name)) error("could not run")
if (system(kraken_path + " " + test_name + ".krak > " + results_file_name)) error("could not compile")
if (system(string("./") + test_name + " >> " + results_file_name)) error("could not run")
if (file_exists(results_file_name) && file_exists(expected_results_file_name) && read_file(results_file_name) == read_file(expected_results_file_name)) {
println(test_name + "\tPASSED!")
all_results += pad_with_spaces(test_name) + "\tPASSED!\n"