Skip to content

Commit

Permalink
Basic support for v5
Browse files Browse the repository at this point in the history
  • Loading branch information
labordep committed Sep 3, 2023
1 parent a02c96f commit 6113623
Show file tree
Hide file tree
Showing 9 changed files with 376 additions and 56 deletions.
64 changes: 56 additions & 8 deletions Gameye-Tests/GameyeCollectionFactoryTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Class {
#name : #GameyeCollectionFactoryTest,
#superclass : #TestCase,
#instVars : [
'datas'
'datas',
'gameyeVersion'
],
#category : #'Gameye-Tests-Core'
}
Expand Down Expand Up @@ -33,16 +34,10 @@ GameyeCollectionFactoryTest class >> exportedSpreadsheetSampleFilename [
^'2_20_2023_ge_collection'
]

{ #category : #assertions }
GameyeCollectionFactoryTest >> assertCollection: aCollection equalsGameyeVersion: aGameyeVersion [

self assert: aCollection gameyeVersion equals: aGameyeVersion
]

{ #category : #assertions }
GameyeCollectionFactoryTest >> assertCollectionGameyeVersion: aCollection [

self subclassResponsibility
self assertCollection: aCollection gameyeVersion equals: gameyeVersion
]

{ #category : #assertions }
Expand Down Expand Up @@ -70,6 +65,59 @@ GameyeCollectionFactoryTest >> assertWishAndForSellCollectionsAreEmpty: collecti
self assert: forSellCollection numberOfCollectibles equals: 0
]

{ #category : #'tests - common' }
GameyeCollectionFactoryTest >> createCollectionFromExportedSpreadsheet_1System [
| collection collectible |

collection := datas at: GameyeCollection owned.
self assert: collection date equals: (Date newDay: 20 month: 2 year: 2023).
self assert: collection haveUnknowns equals: false.
self assert: collection haveVideoGames equals: false.
self assert: collection haveSystems equals: true.
self assert: collection havePeripherals equals: false.
self assert: collection haveToyToLife equals: false.
self assert: collection havePrintMedias equals: false.
self assert: collection numberOfCollectibles equals: 1.

collectible := collection systemsCollectibles first.
self assert: collectible isSystem.
self assert: collectible isOwned.
self assert: collectible dateAdded equals: (Date newDay: 18 month: 7 year: 2022).
self assert: collectible isBoxed.
self assert: collectible priceLoose equals: 88.91.
self assert: collectible priceCIB equals: 169.46.
self assert: collectible priceNew equals: 381.99.
self assert: collectible yourPrice equals: 156.75.
self assert: collectible pricePaid equals: 139.92.
self assert: collectible itemCondition equals: 10.
self assert: collectible boxCondition isNil.
self assert: collectible manualCondition equals: 10.
self assert: collectible notes isNil.

self assertWishAndForSellCollectionsAreEmpty: datas
]

{ #category : #'tests - common' }
GameyeCollectionFactoryTest >> createCollectionFromExportedSpreadsheet_1ToyToLife [
| collection collectible |

collection := datas at: GameyeCollection owned.
self assert: collection date equals: (Date newDay: 20 month: 2 year: 2023).
self assert: collection haveUnknowns equals: false.
self assert: collection haveVideoGames equals: false.
self assert: collection haveSystems equals: false.
self assert: collection havePeripherals equals: false.
self assert: collection haveToyToLife equals: true.
self assert: collection havePrintMedias equals: false.
self assert: collection numberOfCollectibles equals: 1.

collectible := collection toysToLifeCollectibles first.
self assert: collectible dateAdded equals: (Date newDay: 19 month: 4 year: 2022).
self assert: collectible isToyToLife.

self assertWishAndForSellCollectionsAreEmpty: datas
]

{ #category : #running }
GameyeCollectionFactoryTest >> setUp [

Expand Down
74 changes: 27 additions & 47 deletions Gameye-Tests/GameyeCollectionFactoryV4Test.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,53 @@ Class {
#category : #'Gameye-Tests-Core'
}

{ #category : #'samples - v4' }
{ #category : #samples }
GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_1Peripheral [

^self exportedSpreadsheetSampleHeadContentV4, '
"N64","Peripherals",1,0,0,"Expansion Pak","Missing Field","Missing Field","10/07/2021","CIB","46.63","77.35","112.19","77.35","51.85","10","10","10"," "," ",""'
]

{ #category : #'samples - v4' }
{ #category : #samples }
GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_1PeripheralAsAUnknownCollectible [

^self exportedSpreadsheetSampleHeadContentV4, '
"SNES","?",1,0,0,"Super Scope 6 [Gun Bundle]","Missing Field","Missing Field","13/09/2021","Boxed","-1.0", "-1.0", "-1.0", "-1.0","55.97","10","?","9"," "," ","This is a commentary"'
]

{ #category : #'samples - v4' }
{ #category : #samples }
GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_1PrintMedia [
"1 Print media sample"

^self exportedSpreadsheetSampleHeadContentV4, '
"N Power","Print Media",1,0,0,"[Vol. 145] Mario Advance","Missing Field","Missing Field","11/03/2023","Loose","9.49","14.23","?","9.49","1.90","?","?","10"," "," ",""'
]

{ #category : #'samples - v4' }
{ #category : #samples }
GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_1System [
"1 System sample"

^self exportedSpreadsheetSampleHeadContentV4, '
"Saturn","Systems",1,0,0,"Sega Saturn Console (PAL)","Missing Field","Missing Field","18/07/2022","Boxed","88.91","169.46","381.99","156.75","139.92","10","?","10"," "," ",""'
]

{ #category : #'samples - v4' }
{ #category : #samples }
GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_1ToyToLife [
"1 System sample"

^self exportedSpreadsheetSampleHeadContentV4, '
"amiibo","ToysToLife",1,0,0,"Zelda - Breath of Wild","Missing Field","Missing Field","19/04/2022","Loose","26.11","26.11","36.44","26.11","13.99","?","?","10"," "," ",""'
]

{ #category : #'samples - v4' }
{ #category : #samples }
GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_1VideoGameWitComplexeStringValues [
"This game have title and developper names with coma and quotes : ""Ivan ""Ironman"" Stewart's Super Off Road"" and ""Rare, Ltd."""

^self exportedSpreadsheetSampleHeadContentV4, '
"NES","VideoGame",1,0,0,"Ivan "Ironman" Stewart''s Super Off Road","Tradewest, Inc.","Rare, Ltd.","22/03/2021","CIB","10.85","46.64","326.48","46.64","-1.0","6","7","7"," "," ",""'
]

{ #category : #'accessing - v4' }
{ #category : #samples }
GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_3VideoGames2SystemsWitComplexeStringValues [
"This is an extract from problematic strings content"

Expand All @@ -62,7 +62,7 @@ GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_3Video
"PS1","VideoGame",1,0,0,"Broken Sword 2 - Les Boucliers de Quetzalcoatl","Sony","Revolution Software Ltd.","22/03/2021","CIB","-1.0", "-1.0", "-1.0", "-1.0","-1.0","10","10","10"," "," ",""'
]

{ #category : #'samples - v4' }
{ #category : #samples }
GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_4VideoGamesWitComplexeStringValues [
"This game have title and developper names with coma and quotes : ""Ivan ""Ironman"" Stewart's Super Off Road"" and ""Rare, Ltd."""

Expand All @@ -73,39 +73,40 @@ GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_4Video
"Atari 2600","VideoGame",1,0,0,"Space Invaders","(null)","(null)","22/03/2021","Loose","-1.0", "-1.0", "-1.0", "-1.0","?","?","?","5"," "," ","Étiquette percée, en pack avec la console"'
]

{ #category : #'samples - v4' }
{ #category : #samples }
GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_Empty [
"This sample contains some frequently generated cases not easy to read/parse or exceptions due to collection evolution"

^self exportedSpreadsheetSampleHeadContentV4
]

{ #category : #'samples - v4' }
{ #category : #samples }
GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleContentV4_Wishlist_1VideoGame [
"This game have title and developper names with coma and quotes : ""Ivan ""Ironman"" Stewart's Super Off Road"" and ""Rare, Ltd."""

^self exportedSpreadsheetSampleHeadContentV4, '
"Switch","VideoGame",0,0,1,"Advance Wars 1+2: Re-Boot Camp","Nintendo","WayForward Technologies","","Wishlist","-1.0", "-1.0", "-1.0", "-1.0","-1.0"," "," "," "," "," ",""'
]

{ #category : #'accessing - v4' }
{ #category : #accessing }
GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleFileReferenceV4_Empty [
<script:'self exportedSpreadsheetSampleFileReferenceV4_Empty inspect'>

^self exportedSpreadsheetSampleFileReference: self exportedSpreadsheetSampleContentV4_Empty
]

{ #category : #'accessing - v4' }
{ #category : #accessing }
GameyeCollectionFactoryV4Test class >> exportedSpreadsheetSampleHeadContentV4 [
"This sample contains columns head"

^'Platform,Type,Owned,ForSale,Wishlist,Title,Publisher,Developer,DateAdded,Ownership,PriceLoose,PriceCIB,PriceNew,YourPrice,PricePaid,ItemCondition,BoxCondition,ManualCondition,Beat,PlayedCompletion,Notes'
]

{ #category : #assertions }
GameyeCollectionFactoryV4Test >> assertCollectionGameyeVersion: aCollection [
GameyeCollectionFactoryV4Test >> setUp [

self assertCollection: aCollection equalsGameyeVersion: GameyeVersion v4
super setUp.
gameyeVersion := GameyeVersion v4.
]

{ #category : #'tests - v4' }
Expand Down Expand Up @@ -185,49 +186,28 @@ GameyeCollectionFactoryV4Test >> testCreateCollectionFromExportedSpreadsheet_1Pr
{ #category : #'tests - v4' }
GameyeCollectionFactoryV4Test >> testCreateCollectionFromExportedSpreadsheet_1System [

| collection collectible collections |
collections := GameyeCollectionFactory createCollectionsFromExportedSpreadsheet: (self class
| collectible collection |
datas := GameyeCollectionFactory createCollectionsFromExportedSpreadsheet: (self class
exportedSpreadsheetSampleFileReference: self class exportedSpreadsheetSampleContentV4_1System).

collection := collections at: GameyeCollection owned.
self assert: collection date equals: (Date newDay: 20 month: 2 year: 2023).
self assert: collection haveUnknowns equals: false.
self assert: collection haveVideoGames equals: false.
self assert: collection haveSystems equals: true.
self assert: collection havePeripherals equals: false.
self assert: collection haveToyToLife equals: false.
self assert: collection havePrintMedias equals: false.
self assert: collection numberOfCollectibles equals: 1.

self createCollectionFromExportedSpreadsheet_1System.

collection := datas at: GameyeCollection owned.
collectible := collection systemsCollectibles first.
self assert: collectible dateAdded equals: (Date newDay: 18 month: 7 year: 2022).
self assert: collectible isSystem.

self assertWishAndForSellCollectionsAreEmpty: collections
self assert: collectible platform equals: 'Saturn'.
self assert: collectible title equals: 'Sega Saturn Console (PAL)'.
self assert: collectible country isNil.
self assert: collectible releaseType isNil.
self assert: collectible tags isNil.
]

{ #category : #'tests - v4' }
GameyeCollectionFactoryV4Test >> testCreateCollectionFromExportedSpreadsheet_1ToyToLife [

| collection collectible collections |
collections := GameyeCollectionFactory createCollectionsFromExportedSpreadsheet: (self class
datas := GameyeCollectionFactory createCollectionsFromExportedSpreadsheet: (self class
exportedSpreadsheetSampleFileReference: self class exportedSpreadsheetSampleContentV4_1ToyToLife).

collection := collections at: GameyeCollection owned.
self assert: collection date equals: (Date newDay: 20 month: 2 year: 2023).
self assert: collection haveUnknowns equals: false.
self assert: collection haveVideoGames equals: false.
self assert: collection haveSystems equals: false.
self assert: collection havePeripherals equals: false.
self assert: collection haveToyToLife equals: true.
self assert: collection havePrintMedias equals: false.
self assert: collection numberOfCollectibles equals: 1.

collectible := collection toysToLifeCollectibles first.
self assert: collectible dateAdded equals: (Date newDay: 19 month: 4 year: 2022).
self assert: collectible isToyToLife.

self assertWishAndForSellCollectionsAreEmpty: collections
self createCollectionFromExportedSpreadsheet_1ToyToLife.
]

{ #category : #'tests - v4' }
Expand Down
75 changes: 75 additions & 0 deletions Gameye-Tests/GameyeCollectionFactoryV5Test.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
Class {
#name : #GameyeCollectionFactoryV5Test,
#superclass : #GameyeCollectionFactoryTest,
#category : #'Gameye-Tests-Core'
}

{ #category : #samples }
GameyeCollectionFactoryV5Test class >> exportedSpreadsheetSampleContentV5_1System [
"self exportedSpreadsheetSampleContentV5_1System"

^self exportedSpreadsheetSampleHeadContentV5, '
"Sega Saturn","Systems","Owned","Sega Saturn Console","United Kingdom","Official","Missing Field","Missing Field","18/07/2022","Boxed","88.91","169.46","381.99","156.75","139.92","10","?","10"," "," ","","✔️ 📦",'
]

{ #category : #samples }
GameyeCollectionFactoryV5Test class >> exportedSpreadsheetSampleContentV5_1ToyToLife [

^self exportedSpreadsheetSampleHeadContentV5, '
"amiibo","Toys To Life","Owned","Zelda - Breath of Wild","","Official","Nintendo","Missing Field","19/04/2022","Loose","24.40","?","29.41","24.40","15.00","10","?","?"," "," ","","",'
]

{ #category : #samples }
GameyeCollectionFactoryV5Test class >> exportedSpreadsheetSampleContentV5_Empty [
"This sample contains some frequently generated cases not easy to read/parse or exceptions due to collection evolution"

^self exportedSpreadsheetSampleHeadContentV5
]

{ #category : #accessing }
GameyeCollectionFactoryV5Test class >> exportedSpreadsheetSampleFileReferenceV5_Empty [
<script:'self exportedSpreadsheetSampleFileReferenceV5_Empty inspect'>

^self exportedSpreadsheetSampleFileReference: self exportedSpreadsheetSampleContentV5_Empty
]

{ #category : #accessing }
GameyeCollectionFactoryV5Test class >> exportedSpreadsheetSampleHeadContentV5 [
"This sample contains columns head"

^'Platform,Category,UserRecordType,Title,Country,ReleaseType,Publisher,Developer,CreatedAt,Ownership,PriceLoose,PriceCIB,PriceNew,YourPrice,PricePaid,ItemCondition,BoxCondition,ManualCondition,Beat,PlayedCompletion,Notes,Tags'
]

{ #category : #running }
GameyeCollectionFactoryV5Test >> setUp [

super setUp.
gameyeVersion := GameyeVersion v5.
]

{ #category : #running }
GameyeCollectionFactoryV5Test >> testCreateCollectionFromExportedSpreadsheet_1System [

| collection collectible |
datas := GameyeCollectionFactory createCollectionsFromExportedSpreadsheet: (self class
exportedSpreadsheetSampleFileReference: self class exportedSpreadsheetSampleContentV5_1System).

self createCollectionFromExportedSpreadsheet_1System.

collection := datas at: GameyeCollection owned.
collectible := collection systemsCollectibles first.
self assert: collectible platform equals: 'Sega Saturn'.
self assert: collectible title equals: 'Sega Saturn Console'.
self assert: collectible country equals: #'United Kingdom'.
self assert: collectible releaseType equals: #'Official'.
self assert: collectible tags notNil.
]

{ #category : #running }
GameyeCollectionFactoryV5Test >> testCreateCollectionFromExportedSpreadsheet_1ToyToLife [

datas := GameyeCollectionFactory createCollectionsFromExportedSpreadsheet: (self class
exportedSpreadsheetSampleFileReference: self class exportedSpreadsheetSampleContentV5_1ToyToLife).

self createCollectionFromExportedSpreadsheet_1ToyToLife.
]
2 changes: 1 addition & 1 deletion Gameye/AbstractGameyeInputDataUtils.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Class {
{ #category : #parsing }
AbstractGameyeInputDataUtils class >> createCollectibleFromDataArray: anArray [

self subclassResponsibility
self subclassResponsibility
]

{ #category : #parsing }
Expand Down
17 changes: 17 additions & 0 deletions Gameye/GameyeAccessory.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Class {
#name : #GameyeAccessory,
#superclass : #GameyePeripheral,
#category : #'Gameye-Model'
}

{ #category : #accessing }
GameyeAccessory class >> type [

^ #'Game Accessories'
]

{ #category : #testing }
GameyeAccessory >> isAccessory [

^ true
]
Loading

0 comments on commit 6113623

Please sign in to comment.