1 // 2 // Copyright (c) 2010-2023 Antmicro 3 // 4 // This file is licensed under the MIT License. 5 // Full license text is available in 'licenses/MIT.txt'. 6 // 7 using Antmicro.Renode.Core; 8 namespace Antmicro.Renode.Utilities 9 { 10 public static class MockExtension 11 { GetMockString(this Emulation str)12 public static string GetMockString(this Emulation str) 13 { 14 return "this is an extension"; 15 } 16 MethodThatTakesParamsIntArray(this Emulation emulation, params int[] args)17 public static string MethodThatTakesParamsIntArray(this Emulation emulation, params int[] args) 18 { 19 return string.Format("args: [{0}]", string.Join(", ", args)); 20 } 21 MethodThatTakesParamsIntArrayAfterString(this Emulation emulation, string arg, params int[] args)22 public static string MethodThatTakesParamsIntArrayAfterString(this Emulation emulation, string arg, params int[] args) 23 { 24 return string.Format("arg: {0} args: [{1}]", arg, string.Join(", ", args)); 25 } 26 MethodThatTakesParamsIntArrayAfterOptionalString(this Emulation emulation, string arg = R, params int[] args)27 public static string MethodThatTakesParamsIntArrayAfterOptionalString(this Emulation emulation, string arg = "default", params int[] args) 28 { 29 return string.Format("arg: {0} args: [{1}]", arg, string.Join(", ", args)); 30 } 31 MethodWithOptionalParameters(this Emulation emulation, int a = 1, int b = 2, int c = 3)32 public static string MethodWithOptionalParameters(this Emulation emulation, int a = 1, int b = 2, int c = 3) 33 { 34 return string.Format("a: {0}, b: {1}, c: {2}", a, b, c); 35 } 36 MethodWithOptionalParametersAndParamArray(this Emulation emulation, int a = 1, int b = 2, int c = 3, params int[] args)37 public static string MethodWithOptionalParametersAndParamArray(this Emulation emulation, int a = 1, int b = 2, int c = 3, params int[] args) 38 { 39 return string.Format("a: {0}, b: {1}, c: {2}; {3}", a, b, c, string.Join(", ", args)); 40 } 41 } 42 } 43