patch 8.2.2916: operators are not fully tested

Problem:    Operators are not fully tested.
Solution:   Add a few more tests. (Yegappan Lakshmanan, closes #8290)
diff --git a/src/testdir/test_netbeans.vim b/src/testdir/test_netbeans.vim
index d792ab9..8dff32d 100644
--- a/src/testdir/test_netbeans.vim
+++ b/src/testdir/test_netbeans.vim
@@ -367,6 +367,46 @@
   call assert_match('2:insert=\d\+ 26 "\t"', l[-1])
   let g:last += 18
 
+  " Test for changing case of multiple lines using ~
+  normal ggVG~
+  call WaitFor('len(ReadXnetbeans()) >= (g:last + 6)')
+  let l = ReadXnetbeans()
+  call assert_match('2:remove=\d\+ 0 8', l[-6])
+  call assert_match('2:insert=\d\+ 0 "FOO BAR2"', l[-5])
+  call assert_match('2:remove=\d\+ 9 8', l[-4])
+  call assert_match('2:insert=\d\+ 9 "BLUE SKy"', l[-3])
+  call assert_match('2:remove=\d\+ 18 9', l[-2])
+  call assert_match('2:insert=\d\+ 18 "\tFOO BAR3"', l[-1])
+  let g:last += 6
+
+  " Test for changing case of a visual block using ~
+  exe "normal ggw\<C-V>$~"
+  call WaitFor('len(ReadXnetbeans()) >= (g:last + 2)')
+  let l = ReadXnetbeans()
+  call assert_match('2:remove=\d\+ 4 4', l[-2])
+  call assert_match('2:insert=\d\+ 4 "bar2"', l[-1])
+  let g:last += 2
+
+  " Increment a number using <C-A> in visual mode
+  exe "normal! gg$v6\<C-A>"
+  call WaitFor('len(ReadXnetbeans()) >= (g:last + 6)')
+  let l = ReadXnetbeans()
+  call assert_match('2:remove=\d\+ 0 9', l[-4])
+  call assert_match('2:insert=\d\+ 0 "FOO bar8"', l[-3])
+  call assert_match('2:remove=\d\+ 7 1', l[-2])
+  call assert_match('2:insert=\d\+ 7 "8"', l[-1])
+  let g:last += 6
+
+  " Decrement a number using <C-X> in visual mode
+  exe "normal! gg$v3\<C-X>"
+  call WaitFor('len(ReadXnetbeans()) >= (g:last + 6)')
+  let l = ReadXnetbeans()
+  call assert_match('2:remove=\d\+ 0 9', l[-4])
+  call assert_match('2:insert=\d\+ 0 "FOO bar5"', l[-3])
+  call assert_match('2:remove=\d\+ 7 1', l[-2])
+  call assert_match('2:insert=\d\+ 7 "5"', l[-1])
+  let g:last += 6
+
   " stopDocumentListen test
   call appendbufline(cmdbufnr, '$', 'stopDocumentListen_Test')
   call WaitFor('len(ReadXnetbeans()) >= (g:last + 3)')
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index 48cc46e..63acebc 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -3377,4 +3377,34 @@
   bw!
 endfunc
 
+" Some commands like yy, cc, dd, >>, << and !! accept a count after
+" typing the first letter of the command.
+func Test_normal_count_after_operator()
+  new
+  setlocal shiftwidth=4 tabstop=8 autoindent
+  call setline(1, ['one', 'two', 'three', 'four', 'five'])
+  let @a = ''
+  normal! j"ay4y
+  call assert_equal("two\nthree\nfour\nfive\n", @a)
+  normal! 3G>2>
+  call assert_equal(['one', 'two', '    three', '    four', 'five'],
+        \ getline(1, '$'))
+  exe "normal! 3G0c2cred\nblue"
+  call assert_equal(['one', 'two', '    red', '    blue', 'five'],
+        \ getline(1, '$'))
+  exe "normal! gg<8<"
+  call assert_equal(['one', 'two', 'red', 'blue', 'five'],
+        \ getline(1, '$'))
+  exe "normal! ggd3d"
+  call assert_equal(['blue', 'five'], getline(1, '$'))
+  call setline(1, range(1, 4))
+  call feedkeys("gg!3!\<C-B>\"\<CR>", 'xt')
+  call assert_equal('".,.+2!', @:)
+  call feedkeys("gg!1!\<C-B>\"\<CR>", 'xt')
+  call assert_equal('".!', @:)
+  call feedkeys("gg!9!\<C-B>\"\<CR>", 'xt')
+  call assert_equal('".,$!', @:)
+  bw!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim
index 2b3b213..1b3661c 100644
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -818,7 +818,99 @@
   exe "normal ld\<C-V>j"
   call assert_equal(['13', '46', '789'], getline(1, '$'))
 
+  " Test from ':help v_b_I_example'
+  %d _
+  setlocal tabstop=8 shiftwidth=4
+  let lines =<< trim END
+    abcdefghijklmnopqrstuvwxyz
+    abc		defghijklmnopqrstuvwxyz
+    abcdef  ghi		jklmnopqrstuvwxyz
+    abcdefghijklmnopqrstuvwxyz
+  END
+  call setline(1, lines)
+  exe "normal ggfo\<C-V>3jISTRING"
+  let expected =<< trim END
+    abcdefghijklmnSTRINGopqrstuvwxyz
+    abc	      STRING  defghijklmnopqrstuvwxyz
+    abcdef  ghi   STRING  	jklmnopqrstuvwxyz
+    abcdefghijklmnSTRINGopqrstuvwxyz
+  END
+  call assert_equal(expected, getline(1, '$'))
+
+  " Test from ':help v_b_A_example'
+  %d _
+  let lines =<< trim END
+    abcdefghijklmnopqrstuvwxyz
+    abc		defghijklmnopqrstuvwxyz
+    abcdef  ghi		jklmnopqrstuvwxyz
+    abcdefghijklmnopqrstuvwxyz
+  END
+  call setline(1, lines)
+  exe "normal ggfo\<C-V>3j$ASTRING"
+  let expected =<< trim END
+    abcdefghijklmnopqrstuvwxyzSTRING
+    abc		defghijklmnopqrstuvwxyzSTRING
+    abcdef  ghi		jklmnopqrstuvwxyzSTRING
+    abcdefghijklmnopqrstuvwxyzSTRING
+  END
+  call assert_equal(expected, getline(1, '$'))
+
+  " Test from ':help v_b_<_example'
+  %d _
+  let lines =<< trim END
+    abcdefghijklmnopqrstuvwxyz
+    abc		defghijklmnopqrstuvwxyz
+    abcdef  ghi		jklmnopqrstuvwxyz
+    abcdefghijklmnopqrstuvwxyz
+  END
+  call setline(1, lines)
+  exe "normal ggfo\<C-V>3j3l<.."
+  let expected =<< trim END
+    abcdefghijklmnopqrstuvwxyz
+    abc	      defghijklmnopqrstuvwxyz
+    abcdef  ghi   jklmnopqrstuvwxyz
+    abcdefghijklmnopqrstuvwxyz
+  END
+  call assert_equal(expected, getline(1, '$'))
+
+  " Test from ':help v_b_>_example'
+  %d _
+  let lines =<< trim END
+    abcdefghijklmnopqrstuvwxyz
+    abc		defghijklmnopqrstuvwxyz
+    abcdef  ghi		jklmnopqrstuvwxyz
+    abcdefghijklmnopqrstuvwxyz
+  END
+  call setline(1, lines)
+  exe "normal ggfo\<C-V>3j>.."
+  let expected =<< trim END
+    abcdefghijklmn		  opqrstuvwxyz
+    abc			    defghijklmnopqrstuvwxyz
+    abcdef  ghi			    jklmnopqrstuvwxyz
+    abcdefghijklmn		  opqrstuvwxyz
+  END
+  call assert_equal(expected, getline(1, '$'))
+
+  " Test from ':help v_b_r_example'
+  %d _
+  let lines =<< trim END
+    abcdefghijklmnopqrstuvwxyz
+    abc		defghijklmnopqrstuvwxyz
+    abcdef  ghi		jklmnopqrstuvwxyz
+    abcdefghijklmnopqrstuvwxyz
+  END
+  call setline(1, lines)
+  exe "normal ggfo\<C-V>5l3jrX"
+  let expected =<< trim END
+    abcdefghijklmnXXXXXXuvwxyz
+    abc	      XXXXXXhijklmnopqrstuvwxyz
+    abcdef  ghi   XXXXXX    jklmnopqrstuvwxyz
+    abcdefghijklmnXXXXXXuvwxyz
+  END
+  call assert_equal(expected, getline(1, '$'))
+
   bwipe!
+  set tabstop& shiftwidth&
 endfunc
 
 " Test block-insert using cursor keys for movement