Damien Martin-Guillerez | f88f4d8 | 2015-09-25 13:56:55 +0000 | [diff] [blame] | 1 | // Copyright 2015 The Bazel Authors. All rights reserved. |
Nathan Harmata | 53bd3bf | 2015-04-03 16:12:59 +0000 | [diff] [blame] | 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | package com.google.devtools.build.skyframe; |
| 15 | |
tomlu | a155b53 | 2017-11-08 20:12:47 +0100 | [diff] [blame] | 16 | import com.google.common.base.Preconditions; |
Nathan Harmata | 53bd3bf | 2015-04-03 16:12:59 +0000 | [diff] [blame] | 17 | import org.junit.runner.RunWith; |
| 18 | import org.junit.runners.JUnit4; |
| 19 | |
Googler | 2dd4c18 | 2016-10-31 14:54:37 +0000 | [diff] [blame] | 20 | /** Tests for {@link InMemoryGraphImpl}. */ |
Nathan Harmata | 53bd3bf | 2015-04-03 16:12:59 +0000 | [diff] [blame] | 21 | @RunWith(JUnit4.class) |
Googler | 2dd4c18 | 2016-10-31 14:54:37 +0000 | [diff] [blame] | 22 | public class InMemoryGraphTest extends GraphTest { |
Janak Ramakrishnan | 5245510 | 2015-08-03 17:05:05 +0000 | [diff] [blame] | 23 | private ProcessableGraph graph; |
| 24 | |
Nathan Harmata | 53bd3bf | 2015-04-03 16:12:59 +0000 | [diff] [blame] | 25 | @Override |
Shreya Bhattarai | cc80878 | 2016-02-10 22:17:00 +0000 | [diff] [blame] | 26 | protected Version getStartingVersion() { |
| 27 | return IntVersion.of(0); |
| 28 | } |
| 29 | |
| 30 | @Override |
| 31 | protected Version getNextVersion(Version v) { |
| 32 | Preconditions.checkState(v instanceof IntVersion); |
| 33 | return ((IntVersion) v).next(); |
| 34 | } |
| 35 | |
| 36 | @Override |
Janak Ramakrishnan | 5245510 | 2015-08-03 17:05:05 +0000 | [diff] [blame] | 37 | protected void makeGraph() { |
Janak Ramakrishnan | 8be7fd0 | 2016-05-10 20:01:40 +0000 | [diff] [blame] | 38 | graph = new InMemoryGraphImpl(); |
Janak Ramakrishnan | 5245510 | 2015-08-03 17:05:05 +0000 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | @Override |
| 42 | protected ProcessableGraph getGraph(Version version) { |
| 43 | return graph; |
Nathan Harmata | 53bd3bf | 2015-04-03 16:12:59 +0000 | [diff] [blame] | 44 | } |
| 45 | } |