<commit_before>
assert_pass		macro
			call	assert_pass_r
			endm

assert_fail		macro
			call	assert_fail_r
			endm

inc_done		macro		num_done, done_char
			push		hl
			ld		hl,num_done
			inc		(hl)			; Increment number done
			print_char	done_char		; Print done char
			pop		hl
			endm

assert_pass_r		proc
			inc_done	num_pass, period	; Increment number passed
			ret
			endp
			
assert_fail_r		proc
			local		print_group_end
			set_border_colour	red_border	; Set border to red
			inc_done	num_fail, cross		; Increment number failed
			ld		hl,shown_names
			bit		0,(hl)				; Group name shown already?
			jp		nz,print_group_end		; Skip if so.
			push		de
			ld		de,(cur_group_name_len)		; get string length
			inc		e				; +1 -1 = 0
			dec		e				; sets Z if group name undefined
			pop		de
			jp		z,print_group_end		; skip printing of name if so
			print_newline
			print_text_with_len	(cur_group_name_addr), (cur_group_name_len)
			ld		hl,shown_names
			set		0,(hl)				; Set shown group name
print_group_end		print_newline
			print_char space			; indent test name
			print_text_with_len	(cur_test_name_addr), (cur_test_name_len)
			print_newline
			print_newline
			ret
			endp

assert_a_equals_r	proc			; C = expected, A = actual
			local	passes, done
			cp	c		; does A = expected?
			jp	z,passes	; pass if so
			assert_fail		; otherwise, fail
			print_text expected_txt, expected_txt_end
			ld	b,0
			call	safe_out_num_1
			print_text actual_txt, actual_txt_end
			ld	b,0
			ld	c,a
			call	safe_out_num_1
			print_char	nl
			print_char	nl
			jr	done
passes			assert_pass
done			ret
			endp

assert_a_not_equals_r	proc			; C = not expected, A = actual
			local	passes, done
			cp	c		; does A = not expected?
			jr	nz,passes	; pass if it doesn't
			assert_fail		; otherwise, fail
			jr	done
passes			assert_pass
done			ret
			endp

assert_hl_equals	macro	val			
			local	passes, done
			push	hl
			push	bc		; Backup BC
			ld	bc,val
			push	hl
			sbc	hl,bc		; Subtract val from HL
			pop	hl
			jp	z,passes	; pass if zero
			push	hl
			assert_fail		; otherwise, fail
			print_text expected_txt, expected_txt_end
			call	safe_out_num_1
			print_text actual_txt, actual_txt_end
			pop	bc		; pop HL into BC
			call	safe_out_num_1
			print_char	nl
			print_char	nl
			jp	done
passes			assert_pass
done			pop	bc		; Restore BC
			pop	hl
			endm

assert_a_equals		macro	val
			push	bc		
			ld	c,val		; Store expected in C
			call	assert_a_equals_r
			pop	bc
			endm

assert_reg_equals	macro	val, reg			
			push	af		; Backup A
			ld	a,reg		; Copy register into A
			assert_a_equals	val
			pop	af		; Restore A
			endm

assert_b_equals		macro	val			
			assert_reg_equals val, b
			endm

assert_c_equals		macro	val			
			assert_reg_equals val, c
			endm<commit_msg>Refactor assert_hl_equals into assert_hl_equals_r routine<commit_after>
assert_pass		macro
			call	assert_pass_r
			endm

assert_fail		macro
			call	assert_fail_r
			endm

inc_done		macro		num_done, done_char
			push		hl
			ld		hl,num_done
			inc		(hl)			; Increment number done
			print_char	done_char		; Print done char
			pop		hl
			endm

assert_pass_r		proc
			inc_done	num_pass, period	; Increment number passed
			ret
			endp
			
assert_fail_r		proc
			local		print_group_end
			set_border_colour	red_border	; Set border to red
			inc_done	num_fail, cross		; Increment number failed
			ld		hl,shown_names
			bit		0,(hl)				; Group name shown already?
			jp		nz,print_group_end		; Skip if so.
			push		de
			ld		de,(cur_group_name_len)		; get string length
			inc		e				; +1 -1 = 0
			dec		e				; sets Z if group name undefined
			pop		de
			jp		z,print_group_end		; skip printing of name if so
			print_newline
			print_text_with_len	(cur_group_name_addr), (cur_group_name_len)
			ld		hl,shown_names
			set		0,(hl)				; Set shown group name
print_group_end		print_newline
			print_char space			; indent test name
			print_text_with_len	(cur_test_name_addr), (cur_test_name_len)
			print_newline
			print_newline
			ret
			endp

assert_a_equals_r	proc			; C = expected, A = actual
			local	passes, done
			cp	c		; does A = expected?
			jp	z,passes	; pass if so
			assert_fail		; otherwise, fail
			print_text expected_txt, expected_txt_end
			ld	b,0
			call	safe_out_num_1
			print_text actual_txt, actual_txt_end
			ld	b,0
			ld	c,a
			call	safe_out_num_1
			print_char	nl
			print_char	nl
			jr	done
passes			assert_pass
done			ret
			endp

assert_a_not_equals_r	proc			; C = not expected, A = actual
			local	passes, done
			cp	c		; does A = not expected?
			jr	nz,passes	; pass if it doesn't
			assert_fail		; otherwise, fail
			jr	done
passes			assert_pass
done			ret
			endp

assert_hl_equals_r	proc			; HL = actual, BC = expected
			local	passes, done
			push	hl
			push	hl
			sbc	hl,bc		; Subtract val from HL
			pop	hl
			jp	z,passes	; pass if zero
			push	hl
			assert_fail		; otherwise, fail
			print_text expected_txt, expected_txt_end
			call	safe_out_num_1
			print_text actual_txt, actual_txt_end
			pop	bc		; pop HL into BC
			call	safe_out_num_1
			print_char	nl
			print_char	nl
			jp	done
passes			assert_pass
done			pop	hl
			ret
			endp

assert_hl_equals	macro	val			
			local	passes, done
			push	bc		; Backup BC
			ld	bc,val
			call	assert_hl_equals_r
			pop	bc		; Restore BC
			endm

assert_a_equals		macro	val
			push	bc		
			ld	c,val		; Store expected in C
			call	assert_a_equals_r
			pop	bc
			endm

assert_reg_equals	macro	val, reg			
			push	af		; Backup A
			ld	a,reg		; Copy register into A
			assert_a_equals	val
			pop	af		; Restore A
			endm

assert_b_equals		macro	val			
			assert_reg_equals val, b
			endm

assert_c_equals		macro	val			
			assert_reg_equals val, c
			endm
{'fraction_non_alphanumeric': 0.03688669255206495, 'fraction_numerical': 0.003882809742322626, 'mean_word_length': 2.748015873015873, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1496178', 'n_tokens_mistral': 2777, 'n_tokens_neox': 2302, 'n_words': 666}