-- Unit tests for [[Module:Citation/CS1]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_encyclopedia()
    self:preprocess_equals_preprocess_many('{{cite encyclopedia/new|', '}}', '{{cite encyclopedia|', '}}', {
       { 
[==[
last= LAST
|first= FIRST
|authorlink= AUTHORLINK
|editor-first= EDITOR-FIRST
|editor-last= EDITOR-LAST
|editor-link= EDITOR-LINK
|encyclopedia= ENCYCLOPEDIA
|title= TITLE
|trans-title= TRANS-TITLE
|url=https://en.wikipedia.org/Main_Page
|accessdate= ACCESSDATE
|language= LANGUAGE
|edition= EDITION
|date= DATE
|year= YEAR
|month= MONTH
|publisher= PUBLISHER 
|volume= VOLUME
|location= LOCATION
|id= ID
|isbn= ISBN
|oclc= OCLC
|doi= 10.DOI
|pages= PAGES
|quote= QUOTE
|ref= REF
]==]
},{
[==[
  last =Golden
  |first = Peter B.
  |authorlink =Peter Benjamin Golden
  |editor1-last = Golden
  |editor1-first = Peter B.
  |editor1-link = Peter Benjamin Golden
  |editor2-last =  Ben-Shammai,
  |editor2-first = Haggai
  |editor3-last = Róna-Tas
  |editor3-first = András
  |editor3-link = András Róna-Tas
  |encyclopedia =  The World of the Khazars: New Perspectives
  |title = Khazar Studies: Achievements and Perspectives
  |series = Handbook of Oriental Studies
  |volume = 17
  |publisher = BRILL
  |year = 2007a
  |pages = 7–57
  |isbn = 978-9-004-16042-2
  |url = http://books.google.com/books?id=3ZzXjdyK-CEC&pg=PR2#v=onepage&p=123
  |accessdate = February 13, 2013
  |ref = harv
]==]
}, {
[==[
title=Idaho – MSN Encarta <!-- BOT GENERATED TITLE -->|url=http://encarta.msn.com/encyclopedia_761565515/Idaho.html | archiveurl=http://www.webcitation.org/query?id=1257036681681058 | archivedate=2009-11-01|url-status=dead
]==] 
}
},  {nowiki=false, templatestyles=true})
end

function p:test_news()
    self:preprocess_equals_preprocess_many('{{cite news/new|', '}}', '{{cite news|', '}}', {
       {
[==[ 
  title       = TITLE
 | author      = AUTHOR
 | first       = FIRST
 | last        = LAST
 | authorlink  = AUTHORLINK
 | authorlink2 = AUTHORLINK2
 | author2     = AUTHOR2 
 | author3     = AUTHOR3
 | author4     = AUTHOR4
 | author5     = AUTHOR5
 | author6     = AUTHOR6
 | author7     = AUTHOR7
 | url         = https://en.wikipedia.org/Main_Page
 | format      = FORMAT
 | agency      = AGENCY
 | newspaper   = NEWSPAPER
 | publisher   = PUBLISHER
 | location    = LOCATION
 | isbn        = ISBN
 | issn        = ISSN
 | oclc        = OCLC
 | pmid        = PMID
 | pmc         = PMC
 | bibcode     = BIBCODE
 | doi         = 10.DOI
 | id          = ID
 | date        = DATE
 | page        = PAGE
 | pages       = PAGES
 | at          = AT
 | accessdate  = ACCESSDATE
 | language    = LANGUAGE
 | trans-title = TRANS-TITLE
 | quote       = QUOTE
 | archiveurl  = https://web.archive.org/web/20190310131346/https://en.wikipedia.org/wiki/Main_Page
 | archivedate = ARCHIVEDATE
 | deadurl     = DEADURL
 | ref         = REF
 | notracking=true
]==] }, {

[==[ postscript= | title=Auction Record for an Original 'Alice' | url=http://www.nytimes.com/1998/12/11/nyregion/auction-record-for-an-original-alice.html | date=11 December 1998 | periodical=The New York Times | page=B30
]==] }, {

[==[ last=Rabil | title=New York Times Starts Selling Ad Space on Front Page | url=http://www.bloomberg.com/apps/news?pid=20601103&sid=amsJuEA115pI&refer=us | date=January 5, 2009 | first=Sarah | work=Bloomberg L.P. 
]==] }, {

[==[
title=Drugs: Chips trader gets 15 years, 10 strokes
|url=http://www.dailyexpress.com.my/news.cfm?NewsID=48660
|work=Daily Express |location=Kota Kinabalu, Malaysia
|date=29 March 2007 |agency=Bernama
]==] }
    	
    },  {nowiki=false, templatestyles=true})
end

function p:test_journal()
    self:preprocess_equals_preprocess_many('{{cite journal/new|', '}}', '{{cite journal|', '}}', {
       {
[==[
  last1 = LAST1
 | first1 = FIRST1
 | authorlink1 = AUTHORLINK1
 | last2 = LAST2
 | first2 = FIRST2
 | authorlink2 = AUTHORLINK2
 | editor-last = EDITOR-LAST
 | editor-first = EDITOR-FIRST
 | editor-link = EDITOR-LINK
 | date = DATE
 | year = YEAR
 | month = MONTH
 | title = TITLE
 | trans-title = TRANS-TITLE
 | journal = JOURNAL
 | volume = VOLUME
 | issue = ISSUE
 | series = SERIES
 | pages = PAGES
 | location = LOCATION
 | publisher = PUBLISHER
 | language = LANGUAGE
 | format = FORMAT
 | type = TYPE
 | arxiv = ARXIV
 | id = ID
 | isbn = ISBN
 | issn = ISSN
 | oclc = OCLC
 | pmid = PMID
 | pmc = PMC
 | bibcode = BIBCODE
 | doi = 10.DOI
 | accessdate = ACCESSDATE
 | url = https://en.wikipedia.org/Main_Page
 | archiveurl = https://web.archive.org/web/20190310131346/https://en.wikipedia.org/wiki/Main_Page
 | archivedate = 1 January 2010
 | laysource = LAYSOURCE
 | laysummary = https://en.wikipedia.org/Wikipedia
 | laydate = 2010-01-01
 | quote = QUOTE
 | ref = REF
 | separator = .
 | postscript = POSTSCRIPT
|notracking = true
]==] }, {

[==[
type=Type | title=Article | format=Format | author=Author | journal=Journal | notracking=true
]==] }, {

[==[ 
department=Bryan on Scouting | last=Wendell | title=Calendar of New Merit Badges | url=http://blog.scoutingmagazine.org/merit-badge-calendar/ | journal=Scouting | first=Bryan ]==] },{

[==[ 
archiveurl=http://wikiwix.com/cache/?url=http%3A%2F%2Fphysics.aps.org%2Farticles%2Fv3%2F98 | date=November 22, 2010 | doi=10.1103/Physics.3.98 | first1=Paul | volume=3 | editor-first=Gene D. | editor-last=Sprouse | url=http://physics.aps.org/articles/v3/98 | issue=98 | journal=Physics | title=Meet a superpartner at the LHC | issn=1943-2879 | publisher=American Physical Society | archivedate=2011-02-22 | oclc=233971234 | location=New York | bibcode=2010PhyOJ...3...98L | last1=Langacker | accessdate=21 February 2011 
]==] }
    	
    },  {nowiki=false, templatestyles=true})
end

function p:test_book()
    self:preprocess_equals_preprocess_many('{{cite book/new|', '}}', '{{cite book|', '}}', {
       {
[==[
 last                  = LAST
| first                 = FIRST
| authorlink            = AUTHORLINK
| last2               = LAST2
| first2              = FIRST2
| authorlink2         = AUTHORLINK2
| editor-last           = EDITOR-LAST
| editor-first          = EDITOR-FIRST
| editor-link           = EDITOR-LINK
| editor2-last        = EDITOR2-LAST
| editor2-first       = EDITOR2-FIRST
| editor2-link        = EDITOR2-LINK
| others                = OTHERS
| title                 = TITLE
| trans-title           = TRANS-TITLE
| url                   = https://en.wikipedia.org/Main_Page
| archiveurl            = https://web.archive.org/web/20190310131346/https://en.wikipedia.org/wiki/Main_Page
| archivedate           = January 1, 2010
| format                = FORMAT
| accessdate            = 1 January, 2010
| type                  = TYPE
| edition               = EDITION
| series                = SERIES
| volume                = VOLUME
| date                  = DATE
| origyear              = ORIGYEAR
| year                  = YEAR
| month                 = MONTH
| publisher             = PUBLISHER
| location              = LOCATION
| language              = LANGUAGE
| isbn                  = ISBN
| oclc                  = OCLC
| lccn                  = LCCN
| doi                   = 10.DOI
| bibcode               = BIBCODE
| id                    = ID
| page                  = PAGE
| pages                 = PAGES
| nopp                  = NOPP
| at                    = AT
| chapter               = CHAPTER
| trans-chapter         = TRANS-CHAPTER
| chapterurl            = https://en.wikipedia.org/Main_Page#top
| quote                 = QUOTE
| ref                   = REF
| laysummary            = https://en.wikipedia.org/Wikipedia
| laydate               = 2010-01-01
| author-mask           = AUTHOR-MASK
| author-name-separator =, 
| author-separator      = ;
| display-authors       = 10
| separator             = .
| postscript            = POSTSCRIPT
| lastauthoramp         = 
| notracking = true
]==] }, {

[==[ last=Rabinovich|first=Viktor Abramovich |author2=Vasserman, A. A.|author3=Nedostup, V. I. |author4=Veksler, L. S.|title=Thermophysical properties of neon, argon, krypton, and xenon|year=1988|edition=English-language |publisher=Hemisphere Publishing Corp. |location=Washington, DC|isbn=0-89116-675-0 |url=http://adsabs.harvard.edu/abs/1988wdch...10.....R |accessdate=2009-04-02
]==] }, {

[==[ author=Anonymous|editor=Daniel Coit Gilman |editor2=Harry Thurston Peck |editor3=Frank Moore Colby |year=1904|title=The New International Encyclopædia |publisher=Dodd, Mead and Company|page=906
]==] }, {

[==[ pages=1328–1334|title=Linus Pauling: Selected Scientific Papers|volume=2|editor=Pauling, Linus |editor2=Kamb, Barclay |place=River Edge, New Jersey|publisher=World Scientific |year=2001|isbn=981-02-2940-2|url=http://books.google.com/?id=2QduA19d_X8C&pg=PA1329
]==] }
    	
    },  {nowiki=false, templatestyles=true})
end

function p:test_citation()
    self:preprocess_equals_preprocess_many('{{citation/new|', '}}', '{{citation|', '}}', { {
[==[
author  = AUTHOR
| last    = LAST
| first   = FIRST
| author2 = AUTHOR2
| last2   = LAST2
| first2  = FIRST2
| author-link  = AUTHOR-LINK
| author2-link = AUTHOR-LINK2
| author-separator = ;
| author-name-separator =, 
| author-mask = AUTHOR-MASK
| display-authors = et al
| editor        = EDITOR
| editor-last   = EDITOR-LAST
| editor-first  = EDITOR-FIRST
| editor2       = EDITOR2
| editor2-last  = EDITOR2-LAST
| editor2-first = EDITOR2-FIRST
| editor-link   = EDITOR-LINK
| editor2-link  = EDITOR2-LINK
| others   = OTHERS
| publication-date = PUBLICATION-DATE
| date     = DATE
| year     = YEAR
| month    = MONTH
| origyear = ORIGYEAR
| title    = TITLE
| chapter  = CHAPTER
| chapter-url  = https://en.wikipedia.org/Main_Page#top
| contribution = CONTRIBUTION
| contribution-url = CONTRIBUTON-URL
| type    = TYPE
| journal = JOURNAL
| periodical = PERIODICAL
| newspaper  = NEWSPAPER
| magazine   = MAGAZINE
| work = WORK
| edition = EDITION
| series  = SERIES
| volume  = VOLUME
| issue   = ISSUE
| publisher = PUBLISHER
| publication-place = PUBLICATION-PLACE
| place    = PLACE
| language = LANGUAGE
| page  = PAGE
| pages = PAGES
| nopp  = NOPP
| at   = AT
| id   = ID
| isbn = ISBN
| issn = ISSN
| oclc = OCLC
| pmid = PMID
| pmc  = PMC
| bibcode = BIBCODE
| doi = 10.DOI
| doi-inactive-date = 10 June 2015
| url = https://en.wikipedia.org/Main_Page
| accessdate  = ACCESSDATE
| format      = FORMAT
| archiveurl  = https://web.archive.org/web/20190310131346/https://en.wikipedia.org/wiki/Main_Page
| archivedate = January 1, 2010
| quote      = QUOTE
| laysummary = https://en.wikipedia.org/Wikipedia
| laysource  = LAYSOURCE
| laydate    = 2010-01-01
| separator  =, 
| postscript =
| ref = REF
| notracking = true
]==] }, {

[==[  author=Anonymous|editor=Daniel Coit Gilman, Harry Thurston Peck, Frank Moore Colby |year=1904|title=The New International Encyclopædia |publisher=Dodd, Mead and Company|page=906
]==] }, {

[==[  pages=1328–1334|title=Linus Pauling: Selected Scientific Papers|volume=2|editor=Pauling, Linus; Kamb, Barclay |place=River Edge, New Jersey|publisher=World Scientific |year=2001|isbn=981-02-2940-2|url=http://books.google.com/?id=2QduA19d_X8C&pg=PA1329
]==] }, {

[==[  title=Soedirman: Bapak Tentara Indonesia |trans-title=Soedirman: Father of the Indonesian Military |language=Indonesian |last=Adi |first=A. Kresna |publisher=Mata Padi Pressindo |isbn=978-602-95337-1-2 |location=Yogyakarta |ref=harv |year=2011
]==] }, {

[==[  url=http://books.google.ca/books?id=WrkzPcxBnLMC |title=Takhta untuk Rakyat: Celah-celah Kehidupan Sultan Hamengku Buwono IX |trans-title=Serving the People: The Life Story of Sultan Hamengku Buwono IX |language=Indonesian |isbn=978-979-22-6767-9 |editor1-first=Mohamad |editor1-last=Roem |editor1-link=Mohamad Roem |editor2-first=Mochtar |editor2-last=Lubis |editor2-link=Mochtar Lubis |editor3-first=Kustiniyati |editor3-last=Mochtar |editor4-first=Maimoen |editor4-last=S. |last=Nasution |first=A. H. |authorlink=Abdul Haris Nasution |publisher=Gramedia Pustaka Utama |location=Jakarta |year=2011 |origyear=1982 |edition=Revised |ref=harv 
| notracking=true]==] }, {

[==[  author=Luhmann J. G., Russell C. T. |editor=J. H. Shirley and R. W. Fainbridge |title=Venus: Magnetic Field and Magnetosphere |work=Encyclopedia of Planetary Sciences |publisher=Chapman and Hall, New York|year=1997 |url=http://www-spc.igpp.ucla.edu/personnel/russell/papers/venus_mag/ |accessdate=2009-06-28|isbn=978-1-4020-4520-2
]==] }, {

[==[  author=Feldman, M. S.; Ferrara, L. A.; Havenstein, P. L.; Volonte, J. E.; Whipple, P. H. |title=Manned Venus Flyby, February 1, 1967 |publisher=Bellcomm, Inc |url=http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19790072165_1979072165.pdf |format=PDF|year=1967
]==] }, {

[==[  last=Rose |first=Herbert Jennings |authorlink=H.J. Rose |title=A Handbook of Greek Mythology |edition=1st |year=1959 |publisher=E.P. Dutton & Co. |location=New York |language= |isbn=0-525-47041-7 |pages=173
]==] }
    	
    },  {nowiki=false, templatestyles=true})
end


function p:test_press()
    self:preprocess_equals_preprocess_many('{{cite press release/new|', '}}', '{{cite press release|', '}}', { {

[==[
| last        = LAST
| first       = FIRST
| title       = TITLE
| trans-title = TRANS-TITLE
| language    = LANGUAGE
| date        = DATE
| publisher   = PUBLISHER
| location    = LOCATION
| url         = https://en.wikipedia.org/Main_Page
| format      = FORMAT
| accessdate  = ACCESSDATE
| archiveurl  = https://web.archive.org/web/20190310131346/https://en.wikipedia.org/wiki/Main_Page
| archivedate = ARCHIVEDATE
| deadurl     = DEADURL
| quote       = QUOTE
| ref         = REF
| docket      = DOCKET
]==] }, {

[==[  title= Guerrero, Estado atractivo para la inversión turística |publisher= Secretaría de Turismo Estado de Guerrero |date=September 9, 2008 |url= http://www.presidencia.gob.mx/prensa/sectur/?contenido=38527 |language=Spanish |trans-title=Guerrero, an attractive state for tourism investments |accessdate=June 24, 2004 ]==] }, {

[==[  title=Apple to Unveil Next Generation Software at Keynote Address on Monday, June 6 |url=http://www.apple.com/pr/library/2011/05/31wwdc.html |publisher=[[Apple Inc.]] |date=May 31, 2011 |accessdate=May 31, 2011]==] }, {

[==[  title=DOE Seeks Applicants for Solicitation on the Employment Effects of a Transition to a Hydrogen Economy |work=Hydrogen Program |publisher=US Department of Energy |date=2006-03-22 |url=http://web.archive.org/web/20110719105413/http://www.hydrogen.energy.gov/news_transition.html |accessdate=2008-03-16]==] }, {

[==[  title=Warner Bros. Consumer Products Flies High with DC's Superman at Licensing 2005 International; Franchise Set to Reach New Heights in 2005 Leading Up to Feature Film Release of Superman Returns in June 2006 |publisher=Warner Bros. |date= June 16, 2005 |url=http://www.findarticles.com/p/articles/mi_m0EIN/is_2005_June_16/ai_n13816862 | accessdate=January 16, 2007 |quote=With a super hero that transcends all demographics" ... and ... "S-Shie}ld, which continues to be a fashion symbol and hot trend ]==] }
},  {nowiki=false, templatestyles=true})
end

return p