local assert = require("luassert")
local util = require("spec.util")

describe("Language", function()
	local lang
	setup(function()
		lang = util.load_c_parser()
	end)
	describe("name", function()
		pending("should (hopefully) return a string", function()
			assert.is.string(lang:name())
		end)
	end)
	describe("symbol_count", function()
		it("should return an integer", function()
			assert.is.number(lang:symbol_count())
		end)
	end)
	describe("state_count", function()
		it("should return an integer", function()
			assert.is.number(lang:state_count())
		end)
	end)
	describe("field_count", function()
		it("should return an integer", function()
			assert.is.number(lang:field_count())
		end)
	end)
	describe("abi_version", function()
		it("should return an integer", function()
			assert.is.number(lang:abi_version())
		end)
	end)
	describe("metadata", function()
		pending("should return a table with semantic version fields", function()
			local meta = lang:metadata()
			assert.is.table(meta)
			assert.is.number(meta.major_version)
			assert.is.number(meta.minor_version)
			assert.is.number(meta.patch_version)
		end)
	end)
	describe("symbol_for_name", function()
		it("should return an integer", function()
			assert.is.number(lang:symbol_for_name("primitive_type", true))
		end)
	end)
	describe("symbol_name", function()
		it("should return a string", function()
			assert.is.string(lang:symbol_name(1))
		end)
	end)
	describe("symbol_type", function()
		it("should return a string", function()
			assert.is.string(lang:symbol_type(1))
		end)
	end)
	describe("supertypes", function()
		it("should return an array of integers", function()
			local arr = lang:supertypes()
			assert.is.table(arr)
			for _, v in ipairs(arr) do
				assert.is.number(v)
			end
		end)
	end)
	describe("subtypes", function()
		it("should return an array of integers", function()
			local arr = lang:subtypes(1)
			assert.is.table(arr)
			for _, v in ipairs(arr) do
				assert.is.number(v)
			end
		end)
	end)
	describe("next_state", function()
		it("should return an integer", function()
			assert.is.number(lang:next_state(1, 1))
		end)
	end)
end)
