Commits

Yuri Bochkarev committed 73d2568

+ moar sample image files
+ added moar test cases in total of 37
* updated radikal parser to match current engine's html output

Comments (0)

Files changed (13)

 2011-09-07 (v. 0.2.0) Yuri Bochkarev  <baltazar.bz@gmail.com>
-	+ added config files
+    + added config files
     + radikal, rghost auth info is read from config file
 BIN_DIR=bin
 DEBUG_TARGET=imp.debug
 RELEASE_TARGET=imp.release
-TEST_TARGET=tests
+TEST_TARGET=imp.tests
 GHC_OPTIONS=-odir ${O_DIR} -hidir ${HI_DIR} -i${SRC_DIR} -cpp
 DEBUG_OPTIONS=-prof -auto-all -rtsopts=all -DIMAGEPASTE_DEBUG
 
 	rm -f ${BIN_DIR}/${TEST_TARGET}
 
 check:
-	#cd src
 	ghc --make ${GHC_OPTIONS} ${SRC_DIR}/Tests.hs -o ${BIN_DIR}/${TEST_TARGET}
-	#runghc ${GHC_OPTIONS} ${SRC_DIR}/Tests.hs
-	cd tests && ../bin/tests
+	${BIN_DIR}/${TEST_TARGET}
+

notes/features.txt

     [_] add yfrog.com
     [_] add tinypic.com
     [_] add imgur.com
+    [_] add scrin.org
 
 [+] configuration
     [_] read HTTP proxy info from config
     [+] convert filename to short name if necessary
         file name is always converted to short
 
-[_] testing
-    [_] add automated engine tests (use HUnit to test impure code)
+[+] testing
+    [+] add automated engine tests (use HUnit to test impure code)
+        $ make check
 
 [_] utility
     [_] write man page
     [_] add yaourt package
-    [_] add cabal package
+    [+] add cabal package
 

src/EngineRadikal.hs

   Engine.TextField "GEO_POINT_ID" "",
   Engine.TextField "URLF" "",
   Engine.TextField "" "0",
-  Engine.TextField "O" "yes",
   Engine.TextField "M" "640",
   Engine.TextField "JQ" "85",
-  Engine.TextField "J" "yes",
   Engine.TextField "IM" "7",
   Engine.TextField "VM" "180",
   Engine.TextField "R" "0",
   liftIO $ msgDebug $ show context
 
   response <- liftIO $ Engine.sendPostWithFile context
-  link <- liftIO $ Processing.extractLinks response "img" "src" $ Tools.fileExtension (Engine.pcFileName context) ++ "$"
+  link <- liftIO $ Processing.extractLinks response "input" "value" $ Tools.fileExtension (Engine.pcFileName context) ++ "$"
   case link of
     Nothing -> return ()
     Just x -> put context { Engine.pcResultLink = link } >> return ()
---module Tests (main) where
-
 import Test.HUnit
 import Data.Maybe
 
 import qualified Runner
 import qualified Configuration
 
-foo :: Int -> Int
-foo x = x
+samplesPath = "tests/samples/"
 
-filename = "hello.jpg"
+imageFiles = ["hello.jpg", "pixel.jpg", "cat.jpg", "cubes.png", "diablo.png"]
+zipFiles = ["gtk3.zip"]
+
+allEngines = Runner.defaultPriority
+fileEngines = ["rghost", "ompldr"]
 
 testEngineOnFile :: String -> String -> Configuration.Configuration -> IO ()
 testEngineOnFile engine file config = do
-  result <- Runner.runArgs [engine, file] config
+  result <- Runner.runArgs [engine, samplesPath ++ file] config
   assertBool ("test_" ++ show engine ++ "_" ++ show file) (isJust result)
 
 makeTestLabel file engine = TestLabel
-                            ("test_" ++ engine)
+                            ("test_" ++ engine ++ "_" ++ file)
                             (TestCase (testEngineOnFile engine file Configuration.dummyConf))
 
-genEngineTests file = [makeTestLabel file engine | engine <- Runner.defaultPriority]
+genLabels files engines = [makeTestLabel f e | f <- files, e <- engines]
 
-tests = TestList $ genEngineTests "hello.jpg"
---tests = TestList $ genEngineTests "gtk3.zip"
+tests = TestList $ genLabels imageFiles allEngines ++ genLabels zipFiles fileEngines
 
 main :: IO ()
 main = do
Add a comment to this file

tests/samples/1.jpg

Removed
Old image
Add a comment to this file

tests/samples/caac9eb9a4206ef5448e03706f671de9.jpg

Removed
Old image
Added
New image
Add a comment to this file

tests/samples/cubes.png

Added
New image
Add a comment to this file

tests/samples/diablo.png

Added
New image
Add a comment to this file

tests/samples/image.jpg

Removed
Old image
Add a comment to this file

tests/samples/image.png

Removed
Old image
Add a comment to this file

tests/samples/sample.jpg

Removed
Old image
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.