about summary refs log tree commit diff stats
path: root/apps/ex13.subx
blob: b7e802fdce16093d2b809b3e90c52f0f0e57f2de (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Compare 3 and 3.
#
# To run:
#   $ ./bootstrap translate init.linux apps/ex13.subx -o apps/ex13
#   $ ./bootstrap run apps/ex13
# Expected result:
#   $ echo $?
#   1

== code
#   instruction                     effective address                                                   register    displacement    immediate
# . op          subop               mod             rm32          base        index         scale       r32
# . 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes

Entry:
    b8/copy-to-eax  3/imm32
    3d/compare-eax-and  3/imm32
    0f 94/set-if-=                  3/mod/direct    3/rm32/ebx    .           .             .           .           .               .                 # set ebx to ZF
    81 4/subop/and                  3/mod/direct    3/rm32/ebx    .           .             .           .           .               0xff/imm32        # AND with eax

$exit:
    # exit(ebx)
    e8/call  syscall_exit/disp32

# . . vim:nowrap:textwidth=0
PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from unittest import TestCase, main import random import ranger.colorschemes from ranger.gui.colorscheme import ColorScheme from ranger.gui.context import CONTEXT_KEYS class Test(TestCase): def setUp(self): import random import curses curses.COLORS = 88 schemes = [] for key, mod in vars(ranger.colorschemes).items(): if type(mod) == type(random): for key, var in vars(mod).items(): if type(var) == type and issubclass(var, ColorScheme) \ and var != ColorScheme: schemes.append(var) self.schemes = set(schemes) def test_colorschemes(self): def test(scheme): scheme.get() # test with no arguments for i in range(300): # test with a bunch of random (valid) arguments sample = random.sample(CONTEXT_KEYS, random.randint(2, 9)) scheme.get(*sample) for scheme in self.schemes: test(scheme()) if __name__ == '__main__': main()