Fix T() style casts

This commit is contained in:
Sam Tebbs 2019-11-10 12:35:08 +00:00
parent 2587b9f16c
commit 7b2d4c1190
13 changed files with 287 additions and 287 deletions

View file

@ -293,7 +293,7 @@ fn Mock() type {
// Test that the types match
const expect_type = comptime getDataElementType(ExpectedType);
expectEqual(expect_type, DataElementType(elem));
expectEqual(expect_type, @as(DataElementType, elem));
// Types match, so can use the expected type to get the actual data
const actual_value = getDataValue(ExpectedType, elem);
@ -323,7 +323,7 @@ fn Mock() type {
const ret = getDataValue(DataType, action.data);
expectEqual(DataElementType(action.data), expect_type);
expectEqual(@as(DataElementType, action.data), expect_type);
// Free the node
action_list.*.destroyNode(action_node, GlobalAllocator);
@ -429,7 +429,7 @@ fn Mock() type {
const expect_type = comptime getDataElementType(expected_function);
// Test that the types match
expectEqual(expect_type, DataElementType(test_element));
expectEqual(expect_type, @as(DataElementType, test_element));
// Types match, so can use the expected type to get the actual data
const actual_function = getDataValue(expected_function, test_element);
@ -462,7 +462,7 @@ fn Mock() type {
const expect_type = comptime getDataElementType(expected_function);
// Test that the types match
expectEqual(expect_type, DataElementType(test_element));
expectEqual(expect_type, @as(DataElementType, test_element));
// Types match, so can use the expected type to get the actual data
const actual_function = getDataValue(expected_function, test_element);
@ -520,7 +520,7 @@ fn Mock() type {
switch (action.action) {
ActionType.TestValue, ActionType.ConsumeFunctionCall => {
// These need to be all consumed
std.debug.panic("Unused testing value: Type: {}, value: {} for function '{}'\n", action.action, DataElementType(action.data), next.key);
std.debug.panic("Unused testing value: Type: {}, value: {} for function '{}'\n", action.action, @as(DataElementType, action.data), next.key);
},
ActionType.RepeatFunctionCall => {
// As this is a repeat action, the function will still be here

View file

@ -70,11 +70,11 @@ pub fn init() void {
// User defined mocked functions
pub fn orig_entryColour(fg: u4, bg: u4) u8 {
return u8(fg) | u8(bg) << 4;
return fg | @as(u8, bg) << 4;
}
pub fn orig_entry(uc: u8, c: u8) u16 {
return u16(uc) | u16(c) << 8;
return uc | @as(u16, c) << 8;
}
pub fn mock_updateCursor(x: u16, y: u16) void {