public static SuffixArray Create <T>(T[] str) { var sa = StringLib.SuffixArray(str); var lcp = StringLib.LCPArray(str, sa); return(new SuffixArray(sa, lcp)); }
public void T04_ExpandTo_NegativeTargetLength_ThrowsException() { string inputText = "Anyway"; int targetLength = -1; Assert.Throws <ArgumentOutOfRangeException>(() => StringLib.ExpandTo(inputText, targetLength)); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button button = FindViewById <Button>(Resource.Id.myButton); EditText amountEditText = FindViewById <EditText>(Resource.Id.editTextAmount); TextView resultTextView = FindViewById <TextView>(Resource.Id.textViewResult); button.Click += delegate { var input = amountEditText.Text; try { var conversion = CurrencyConverter.ConvertDollarsToPunds(input); resultTextView.Text = StringLib.DollarToPunds(input, conversion); } catch (FormatException fe) { // Show error message Toast.MakeText(this, StringLib.CONVERSION_ERROR_MESSAGE, ToastLength.Short).Show(); Console.WriteLine(fe); } }; }
public void Titlecase12_DigitsEmbeddedUcLetter_CorrectOutput() { string inputText = "6X7"; string actualOutput = StringLib.Titlecase(inputText); Assert.AreEqual("6x7", actualOutput); }
public void NumberOf_NullSource_ThrowsException() { string sSource = null; char characterToTestFor = 'X'; Assert.Throws(typeof(ArgumentNullException), () => StringLib.NumberOf(sSource, characterToTestFor)); }
public void IsTheSameFilesystemPath_NullPathRef_Exception() { string pathReference = null; string pathToTest = "Path"; Assert.Throws(typeof(ArgumentNullException), () => StringLib.IsTheSameFilesystemPath(pathReference, pathToTest, false)); }
public void ContainsDigits_NullArg_ThrowsException() { string digitFound; int indexOfDigit; Assert.Throws(typeof(ArgumentNullException), () => StringLib.ContainsDigit(null, out digitFound, out indexOfDigit)); }
public void Titlecase10_2Digits_SameOutput() { string inputText = "23"; string actualOutput = StringLib.Titlecase(inputText); Assert.AreEqual("23", actualOutput); }
public void Titlecase08_LcLetterUcLetter_CorrectOutput() { string inputText = "eF"; string actualOutput = StringLib.Titlecase(inputText); Assert.AreEqual("Ef", actualOutput); }
public void WithoutAtStart_NullThisArg() { string s = null; string textToRemoveAtStart = "something to remove"; Assert.Throws(typeof(ArgumentNullException), () => StringLib.WithoutAtStart(s, textToRemoveAtStart)); }
public void Titlecase06_TwoUppercaseLetters_CorrectOutput() { string inputText = "BC"; string actualOutput = StringLib.Titlecase(inputText); Assert.AreEqual("Bc", actualOutput); }
public void Titlecase07_UcLcLettersInput_CorrectOutput() { string inputText = "Cd"; string actualOutput = StringLib.Titlecase(inputText); Assert.AreEqual("Cd", actualOutput); }
public void Titlecase04_OneLowercaseLetterInput_YieldsUppercaseLetterOutput() { string inputText = "b"; string actualOutput = StringLib.Titlecase(inputText); Assert.AreEqual("B", actualOutput); }
public void Titlecase05_TwoLowercaseLetters_CorrectOutput() { string inputText = "xy"; string actualOutput = StringLib.Titlecase(inputText); Assert.AreEqual("Xy", actualOutput); }
public void Titlecase02_NullInput_YieldsEmptyOutput() { string inputText = null; string actualOutput = StringLib.Titlecase(inputText); Assert.AreEqual("", actualOutput); }
public void Titlecase03_OneUppercaseLetterInput_YieldsSameAsOutput() { string inputText = "A"; string actualOutput = StringLib.Titlecase(inputText); Assert.AreEqual("A", actualOutput); }
public void Titlecase09_1Digit_SameOutput() { string inputText = "1"; string actualOutput = StringLib.Titlecase(inputText); Assert.AreEqual("1", actualOutput); }
public void Titlecase11_LcLetter2Digits_CorrectOutput() { string inputText = "a45"; string actualOutput = StringLib.Titlecase(inputText); Assert.AreEqual("A45", actualOutput); }
public void IsTheSameFilesystemPath_2LevelsNoDr_Path2_CorrrectResult() { string pathReference = @"Path1\Path2"; string pathToTest = @"Path2"; bool result = StringLib.IsTheSameFilesystemPath(pathReference, pathToTest, false); Assert.IsFalse(result); }
public void IsTheSameFilesystemPath_Path1Slash_Path1_CorrrectResult() { string pathReference = @"C:\Path1\"; string pathToTest = @"Path1"; bool result = StringLib.IsTheSameFilesystemPath(pathReference, pathToTest, false); Assert.IsTrue(result); }
public void NumberOf_XCommaY_Comma_Return1() { string sSource = "X, Y"; char characterToTestFor = ','; int n = StringLib.NumberOf(sSource, characterToTestFor); Assert.AreEqual(1, n); }
public void TopOfFilesystemPath_DriveAndSlash_CorrectResult() { string remainder; string result = StringLib.TopOfFilesystemPath(@"C:\", out remainder); Assert.AreEqual(@"C:\", result); Assert.IsNull(remainder); }
public void TopOfFilesystemPath_SingleSpace_CorrectResult() { string remainder; string result = StringLib.TopOfFilesystemPath(" ", out remainder); Assert.IsNull(result); Assert.IsNull(remainder); }
public void TopOfFilesystemPath_EmptyString_CorrectResult() { string remainder; string result = StringLib.TopOfFilesystemPath(String.Empty, out remainder); Assert.IsNull(result); Assert.IsNull(remainder); }
public void TopOfFilesystemPath_SlashFolder_CorrectResult() { string remainder; string result = StringLib.TopOfFilesystemPath(@"\Folder1", out remainder); Assert.AreEqual(@"Folder1", result); Assert.IsNull(remainder); }
public void TopOfFilesystemPath_Null_CorrectResult() { string remainder; string result = StringLib.TopOfFilesystemPath(null, out remainder); Assert.IsNull(result); Assert.IsNull(remainder); }
public void Matches_TwoNullArguments() { string source = null; string pattern = null; bool actualOutput = StringLib.Matches(source, pattern); Assert.AreEqual(true, actualOutput); }
public void IsTheSameFilesystemPath_BothEqual_CorrrectResult() { string pathReference = @"C:\Path1"; string pathToTest = @"C:\Path1"; bool result = StringLib.IsTheSameFilesystemPath(pathReference, pathToTest, true); Assert.IsTrue(result); }
public void TopOfFilesystemPath_2Folders_CorrectResult() { string remainder; string result = StringLib.TopOfFilesystemPath(@"Folder1\Folder2", out remainder); Assert.AreEqual("Folder1", result); Assert.AreEqual("Folder2", remainder); }
public void IsTheSameFilesystemPath_Capitalized_Uppercase_CorrrectResult() { string pathReference = @"OnePath"; string pathToTest = "ONEPATH"; bool result = StringLib.IsTheSameFilesystemPath(pathReference, pathToTest, false); Assert.IsTrue(result); }