public void test_actual_param_good(int idx, int expected) { int[] arr_input = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }; Fenwick_Tree ft = new Fenwick_Tree(arr_input); Assert.AreEqual(expected, ft.actual(idx)); }
public void test_actual_bad_data() { int[] arr_input = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }; Fenwick_Tree ft = new Fenwick_Tree(arr_input); Assert.AreEqual(false, ft.actual(3) == 4); }
public void test_update() { int[] arr_input = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }; Fenwick_Tree ft = new Fenwick_Tree(arr_input); ft.update(4, 26); Assert.AreEqual(30, ft.actual(4)); }
private void button3_Click(object sender, EventArgs e) { int a; if (int.TryParse(textBox1.Text, out a)) { if (a < 0 || a >= f.Count) { MessageBox.Show("out of range"); } else { label4.Text = Convert.ToString(f.actual(a)); } } else { MessageBox.Show("Error!"); } }