דף הבית
אקראי
כניסה לחשבון
הגדרות
אודות חב"דפדיה
חב"דפדיה
חיפוש
עריכת הדף "
יחידה:Pgn/בדיקות
"
אזהרה:
אינכם מחוברים לחשבון. כתובת ה־IP שלכם תוצג בפומבי אם תבצעו עריכות כלשהן. אם
תיכנסו לחשבון
או
תיצרו חשבון
, העריכות שלכם תיוחסנה לשם המשתמש שלכם ותקבלו גם יתרונות אחרים.
בדיקת אנטי־ספאם.
אין
למלא שדה זה!
-- Unit tests for [[Module:LocationAndCountry]]. Click talk page to run tests. local p = require('Module:UnitTests') local pgnModule = require('Module:Pgn') -- test extraction of moves to FEN notation - main functionality of the module function p:testFullPgnMoves() local pgn=[[[Event "World Cup"] [Site "Khanty-Mansiysk"] [Date "2007.11.25"] [Round "1.2"] [White "Mamedyarov, Shakhriyar"] [Black "Abdel Razik, Khaled"] [Result "1-0"] [ECO "D43"] [WhiteElo "2752"] [BlackElo "2389"] [PlyCount "65"] [EventDate "2007.11.24"] [EventType "k.o."] [EventRounds "7"] [EventCountry "RUS"] [Source "ChessBase"] [SourceDate "2008.01.30"] 1. d4 e6 2. c4 Nf6 3. Nf3 d5 4. Nc3 c6 5. Bg5 h6 6. Bxf6 Qxf6 7. Qc2 Nd7 8. e4 dxe4 9. Qxe4 Bb4 10. Bd3 g6 11. O-O O-O 12. Qe3 Bxc3 13. bxc3 Kg7 14. a4 b6 15. a5 Ba6 16. Rfb1 Rfc8 17. h4 b5 18. cxb5 Bxb5 19. Bxb5 cxb5 20. Rxb5 Rab8 21. Rab1 Qf5 22. Rxb8 Rxb8 23. Rxb8 Nxb8 24. Ne5 h5 25. c4 f6 26. Qb3 fxe5 27. Qxb8 exd4 28. Qxa7+ Kg8 29. Qb8+ Kh7 30. a6 d3 31. a7 d2 32. a8=Q d1=Q+ 33. Kh2 1-0 ]] metadata, moves = pgnModule.main(pgn) self:preprocess_equals( moves[1], 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR' ) self:preprocess_equals( moves[#moves], 'QQ6/7k/4p1p1/5q1p/2P4P/8/5PPK/3q4' ) end --tests metadata extraction function p:testFullPgnMetadata() local pgn=[[[Event "World Cup"] [Site "Khanty-Mansiysk"] [Date "2007.11.25"] [Round "1.2"] [White "Mamedyarov, Shakhriyar"] [Black "Abdel Razik, Khaled"] [Result "1-0"] [ECO "D43"] [WhiteElo "2752"] [BlackElo "2389"] [PlyCount "65"] [EventDate "2007.11.24"] [EventType "k.o."] [EventRounds "7"] [EventCountry "RUS"] [Source "ChessBase"] [SourceDate "2008.01.30"] 1. d4 e6 2. c4 Nf6 3. Nf3 d5 4. Nc3 c6 5. Bg5 h6 6. Bxf6 Qxf6 7. Qc2 Nd7 8. e4 dxe4 9. Qxe4 Bb4 10. Bd3 g6 11. O-O O-O 12. Qe3 Bxc3 13. bxc3 Kg7 14. a4 b6 15. a5 Ba6 16. Rfb1 Rfc8 17. h4 b5 18. cxb5 Bxb5 19. Bxb5 cxb5 20. Rxb5 Rab8 21. Rab1 Qf5 22. Rxb8 Rxb8 23. Rxb8 Nxb8 24. Ne5 h5 25. c4 f6 26. Qb3 fxe5 27. Qxb8 exd4 28. Qxa7+ Kg8 29. Qb8+ Kh7 30. a6 d3 31. a7 d2 32. a8=Q d1=Q+ 33. Kh2 1-0 ]] metadata, moves = pgnModule.main(pgn) self:preprocess_equals( metadata['Black'] or '', 'Abdel Razik, Khaled' ) self:preprocess_equals( metadata['White'] or '', 'Mamedyarov, Shakhriyar' ) end -- tests algebric notation PGN with no metadata function p:testAlgebricNotation() local pgn=[[1. d4 e6 2. c4 Nf6 3. Nf3 d5 4. Nc3 c6 5. Bg5 h6 6. Bxf6 Qxf6 7. Qc2 Nd7 8. e4 dxe4 9. Qxe4 Bb4 10. Bd3 g6 11. O-O O-O 12. Qe3 Bxc3 13. bxc3 Kg7 14. a4 b6 15. a5 Ba6 16. Rfb1 Rfc8 17. h4 b5 18. cxb5 Bxb5 19. Bxb5 cxb5 20. Rxb5 Rab8 21. Rab1 Qf5 22. Rxb8 Rxb8 23. Rxb8 Nxb8 24. Ne5 h5 25. c4 f6 26. Qb3 fxe5 27. Qxb8 exd4 28. Qxa7+ Kg8 29. Qb8+ Kh7 30. a6 d3 31. a7 d2 32. a8=Q d1=Q+ 33. Kh2 1-0 ]] local metadata, moves success, metadata, moves = pcall(pgnModule.main,pgn) if not success then moves = {'fail'} end self:preprocess_equals( moves[1], 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR' ) self:preprocess_equals( moves[#moves], 'QQ6/7k/4p1p1/5q1p/2P4P/8/5PPK/3q4' ) end return p
תקציר
?
לתשומת ליבך: תרומתך לאתר חב"דפדיה תפורסם לפי תנאי הרישיון GNU Free Documentation License 1.2 (אפשר לעיין בדף
חב"דפדיה:זכויות יוצרים
לפרטים נוספים). אם אינך רוצה שעבודתך תהיה זמינה לעריכה על־ידי אחרים, שתופץ לעיני כול, ושאחרים יוכלו להעתיק ממנה תוך ציון המקור – אין לפרסם אותה פה.
כמו־כן, שמירת העריכה משמעה הבטחה שכתבת את הטקסט הזה בעצמך או העתקת אותו ממקור בנחלת הכלל (שאינו מוגבל בזכויות יוצרים) או מקור חופשי דומה.
אין לשלוח חומר מוגבל בזכויות יוצרים ללא רשות!
ביטול
עזרה בעריכה
(נפתח בחלון חדש)
תבנית המופיעה בדף זה:
יחידה:Pgn/בדיקות/תיעוד
(
עריכה
)