-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #362 from NetLogo/redo-cross-referencing
Redo cross-referencing
- Loading branch information
Showing
4 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
org.nlogo.models.crossReference.singleModels: [ | ||
{ source: "Sample Models/Biology/AIDS.nlogo", referenceIn: "Sample Models/Social Science" } | ||
{ source: "Sample Models/Biology/Simple Birth Rates.nlogo", referenceIn: "Sample Models/Social Science" } | ||
|
||
{ source: "Sample Models/Biology/Evolution/Altruism.nlogo", referenceIn: "Sample Models/Social Science" } | ||
{ source: "Sample Models/Biology/Evolution/Cooperation.nlogo", referenceIn: "Sample Models/Social Science" } | ||
|
||
{ source: "Sample Models/Biology/Evolution/Unverified/Divide The Cake.nlogo", | ||
referenceIn: "Sample Models/Social Science/Unverified" } | ||
|
||
{ source: "Sample Models/Biology/Evolution/Altruism.nlogo", referenceIn: "Curricular Models/EACH" } | ||
{ source: "Sample Models/Biology/Evolution/Cooperation.nlogo", referenceIn: "Curricular Models/EACH" } | ||
|
||
{ source: "Sample Models/Biology/Evolution/Unverified/Divide The Cake.nlogo", | ||
referenceIn: "Curricular Models/EACH/Unverified" } | ||
|
||
{ source: "Sample Models/Networks/Team Assembly.nlogo", referenceIn: "Sample Models/Social Science" } | ||
|
||
{ source: "Code Examples/Extensions Examples/vid/Video Camera Example.nlogo", referenceIn: "Code Examples/Extension Examples/bitmap" } | ||
|
||
// BEAGLE curricular models | ||
{ source: "Sample Models/Biology/Wolf Sheep Predation.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution" } | ||
{ source: "Sample Models/Biology/Evolution/Genetic Drift/GenDrift T interact.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution" } | ||
{ source: "Sample Models/Biology/Evolution/Bug Hunt Speeds.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution" } | ||
{ source: "Sample Models/Biology/Evolution/Bug Hunt Camouflage.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution" } | ||
{ source: "HubNet Activities/Unverified/Guppy Spots HubNet.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution" } | ||
{ source: "Sample Models/Biology/Daisyworld.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution" } | ||
{ source: "Sample Models/Biology/Evolution/Mimicry.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution" } | ||
{ source: "Sample Models/Biology/Evolution/Altruism.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution" } | ||
{ source: "Sample Models/Biology/Evolution/Cooperation.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution" } | ||
{ source: "HubNet Activities/Bug Hunters Camouflage HubNet.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution/HubNet Activities" } | ||
|
||
// copy BEAGLE HubNet models to hubnet activities | ||
{ source: "Curricular Models/BEAGLE Evolution/HubNet Activities/Bird Breeders HubNet.nlogo", referenceIn: "HubNet Activities" } | ||
{ source: "Curricular Models/BEAGLE Evolution/HubNet Activities/Bug Hunters Competition HubNet.nlogo", referenceIn: "HubNet Activities" } | ||
{ source: "Curricular Models/BEAGLE Evolution/HubNet Activities/Critter Designers HubNet.nlogo", referenceIn: "HubNet Activities" } | ||
{ source: "Curricular Models/BEAGLE Evolution/HubNet Activities/Fish Spotters HubNet.nlogo", referenceIn: "HubNet Activities" } | ||
|
||
// Oil Cartel HubNet to HubNet Activities | ||
{ source: "Sample Models/Social Science/Oil Cartel HubNet.nlogo", referenceIn: "HubNet Activities" } | ||
|
||
// IABM Textbook models duplicated in Sample Models and Code Examples | ||
{ source: "IABM Textbook/chapter 3/El Farol Extensions/El Farol.nlogo", referenceIn: "Sample Models/Social Science" } | ||
{ source: "IABM Textbook/chapter 3/DLA Extensions/DLA Simple.nlogo", referenceIn: "Sample Models/Chemistry & Physics/Diffusion Limited Aggregation" } | ||
{ source: "IABM Textbook/chapter 8/Arduino Example.nlogo", referenceIn: "Code Examples/Extensions Examples/arduino" } | ||
] | ||
|
||
org.nlogo.models.crossReference.directories: [ | ||
{ sourceDir: "Sample Models/Mathematics/Probability/ProbLab", referenceIn: "Curricular Models/ProbLab", recursive: false } | ||
{ sourceDir: "Sample Models/Mathematics/Probability/ProbLab/Unverified", | ||
referenceIn: "Curricular Models/ProbLab", recursive: false } | ||
|
||
{ sourceDir: "Sample Models/Chemistry & Physics/GasLab", referenceIn: "Curricular Models/GasLab", recursive: true } | ||
{ sourceDir: "Sample Models/Chemistry & Physics/MaterialSim", referenceIn: "Curricular Models/MaterialSim", recursive: true } | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.nlogo.models | ||
|
||
import java.io.File | ||
import java.nio.file.{ Files, Paths } | ||
|
||
import com.typesafe.config.{ Config, ConfigFactory } | ||
|
||
import org.scalatest.FunSuite | ||
|
||
import scala.collection.JavaConverters._ | ||
|
||
class CrossReferenceTests extends FunSuite { | ||
|
||
val crossReference = ConfigFactory.parseFile(new File("crossReference.conf")) | ||
|
||
test("all cross-referenced single models exist") { | ||
val modelRefs = crossReference.getConfigList("org.nlogo.models.crossReference.singleModels").asScala | ||
modelRefs.foreach { ref => | ||
val source = ref.getString("source") | ||
val path = Paths.get(source) | ||
val realPath = path.toRealPath() | ||
val realSubpath = | ||
realPath.subpath(realPath.getNameCount - path.getNameCount, realPath.getNameCount) | ||
assert( | ||
Files.exists(path) && Files.isRegularFile(path) && | ||
realSubpath.toString == path.toString, | ||
s"expected to find a nlogo file at $source, but couldn't find it!") | ||
} | ||
} | ||
|
||
test("all cross-referenced directories exist and are directories") { | ||
val directoryRefs = crossReference.getConfigList("org.nlogo.models.crossReference.directories").asScala | ||
directoryRefs.foreach { ref => | ||
val source = ref.getString("sourceDir") | ||
val path = Paths.get(source) | ||
val realPath = path.toRealPath() | ||
val realSubpath = | ||
realPath.subpath(realPath.getNameCount - path.getNameCount, realPath.getNameCount) | ||
assert( | ||
Files.exists(path) && Files.isDirectory(path) && | ||
realSubpath.toString == path.toString, | ||
s"expected find a directory at $source, but couldn't find it!") | ||
} | ||
} | ||
} |