TAILIEUCHUNG - Programming - Software Engineering The Practice of Programming phần 7

Tập thể dục 4-6. Viết một phiên bản Java của thư viện CSV, sau đó so sánh ba triển khai thực hiện cho rõ ràng. Dính vào tiêu chuẩn. Bước đầu tiên cho mã di động là tất nhiên để chương trình trong một ngôn ngữ cấp cao, và trong các tiêu chuẩn ngôn ngữ nếu có một. | SECTION TESTING THE MARKOV PROGRAM 161 A second test verified conservation properties. For two-word prefixes every word every pair and every triple that appears in the output of a run must occur in the input as well. We wrote an Awk program that reads the original input into a giant array. builds arrays of all pairs and triples then reads the Markov output into another array and compares the two markov test check that all words pairs triples in output ARCV 2 are i n original input ARCV 1 BEGIN while getline ARCV 1 0 for Ĩ 1 1 NF Ĩ wd nw i input words sing1e i 1 for i 1 i nw Ĩ pal r wd i wd i 1 for i 1 Ĩ nw-1 Ĩ triple wd i wd i l wd i 2 while getline ARCV 2 0 outwd ow 0 output words if 0 i n single print unexpected word . 0 for i 1 i ow i if 1 outwdfi outwd i l in pair print unexpected pair outwdfi outwd i l for i 1 i ow-1 i if outwd i outwd i l outwd i 2 in triple print unexpected triple outwdfi outwd i l outwd i 2 We made no attempt to build an efficient test just to make the test program as simple as possible. It takes six or seven seconds to check a 10 000 word output file against a 42 685 word input file not much longer than some versions of Markov take to generate it. Checking conservation caught a major error in our Java implementation the program sometimes overwrote hash table entries because it used references instead of making copies of prefixes. This test illustrates the principle that it can be much easier to verify a property of the output than to create the output itself. For instance it is easier to check that a file is sorted than to sort it in the first place. A third test is statistical in nature. The input consists of the sequence a b c a b c . a b d . with ten occurrences of abc for each abd. The output should have about 10 times as many c s as d s if the random selection is working properly. We confirm this with freq of course. 162 TESTING CHAPTER 6 The statistical test showed that an early version of the Java program which associated .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.